Method: Mongo::Session#add_start_transaction!

Defined in:
lib/mongo/session.rb

#add_start_transaction!(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 startTransaction field to a command document if applicable.

Examples:

session.add_start_transaction!(cmd)

Returns:

  • (Hash, BSON::Document)

    The command document.

Since:

  • 2.6.0



923
924
925
926
927
928
929
# File 'lib/mongo/session.rb', line 923

def add_start_transaction!(command)
  command.tap do |c|
    if starting_transaction?
      c[:startTransaction] = true
    end
  end
end