Members
-
The server id associated with this session
Methods
-
abortTransaction(callback){Promise}
-
Aborts the currently active transaction in this session.
Name Type Description callbackfunction optional optional callback for completion of this operation
Returns:
promise is returned if no callback is provided
-
advanceOperationTime(operationTime)
-
Advances the operationTime for a ClientSession.
Name Type Description operationTimeTimestamp the
BSON.Timestampof the operation type it is desired to advance to -
commitTransaction(callback){Promise}
-
Commits the currently active transaction in this session.
Name Type Description callbackfunction optional optional callback for completion of this operation
Returns:
promise is returned if no callback is provided
-
endSession(options, callback)
-
Ends this session on the server
Name Type Description optionsObject optional Optional settings. Currently reserved for future use
callbackfunction optional Optional callback for completion of this operation
-
equals(session){boolean}
-
Used to determine if this session equals another
Name Type Description sessionClientSession Returns:
if the sessions are equal
-
incrementTransactionNumber()
-
Increment the transaction number on the internal ServerSession
-
inTransaction(){boolean}
-
Returns:
this session is currently in a transaction or not
-
startTransaction(options)
-
Starts a new transaction with the given options.
Name Type Description optionsTransactionOptions Options for the transaction
-
withTransaction(fn, options)
-
Runs a provided lambda within a transaction, retrying either the commit operation
or entire transaction as needed (and when the error permits) to better ensure that
the transaction can complete successfully.IMPORTANT: This method requires the user to return a Promise, all lambdas that do not
return a Promise will result in undefined behavior.Name Type Description fnWithTransactionCallback optionsTransactionOptions optional Optional settings for the transaction