Module: Mongo::Collection::Helpers Private

Included in:
Mongo::Collection, SearchIndex::View
Defined in:
lib/mongo/collection/helpers.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

This module contains helper methods collection class.

Since:

  • 2.0.0

Instance Method Summary collapse

Instance Method Details

#do_drop(operation, session, context) ⇒ Result

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Executes drop operation and and ignores NamespaceNotFound error.

Parameters:

Returns:

  • (Result)

    The result of the execution.

Since:

  • 2.0.0



31
32
33
34
35
36
37
38
39
40
# File 'lib/mongo/collection/helpers.rb', line 31

def do_drop(operation, session, context)
  operation.execute(next_primary(nil, session), context: context)
rescue Error::OperationFailure::Family => ex
  # NamespaceNotFound
  if ex.code == 26 || ex.code.nil? && ex.message =~ /ns not found/
    false
  else
    raise
  end
end