Method: Mongo::Session#next_txn_num

Defined in:
lib/mongo/session.rb

#next_txn_numInteger

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.

Increment and return the next transaction number.

Examples:

Get the next transaction number.

session.next_txn_num

Returns:

  • (Integer)

    The next transaction number.

Since:

  • 2.5.0



1176
1177
1178
1179
1180
1181
1182
# File 'lib/mongo/session.rb', line 1176

def next_txn_num
  if ended?
    raise Error::SessionEnded
  end

  @server_session.next_txn_num
end