Method: Mongo::Session#add_autocommit!

Defined in:
lib/mongo/session.rb

#add_autocommit!(command) ⇒ Hash, BSON::Document

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.

Add the autocommit field to a command document if applicable.

Examples:

session.add_autocommit!(cmd)

Returns:

  • (Hash, BSON::Document)

    The command document.

Since:

  • 2.6.0



908
909
910
911
912
# File 'lib/mongo/session.rb', line 908

def add_autocommit!(command)
  command.tap do |c|
    c[:autocommit] = false if in_transaction?
  end
end