Global

Methods

applySession(session, command, topology, options){MongoError|null}

Optionally decorate a command with sessions specific keys

Name Type Description
session ClientSession

the session tracking transaction state

command Object

the command to decorate

topology Object

the topology for tracking the cluster time

options Object optional

Optional settings passed to calling operation

Returns:
error, if some error condition was met

Emit event if it exists

Emit event if it exists

isConnectionDead()

Validate if the pool is dead and return error

isCursorDeadAndKilled()

Validate if the cursor is dead and was killed by user

isCursorDeadButNotkilled()

Validate if the cursor is dead but was not explicitly killed by user

isCursorKilled()

Validate if the cursor was killed by the user

isRetryableError(error)

Determines whether an error is something the driver should attempt to retry

Name Type Description
error MongoError | Error

setCursorDeadAndNotified()

Mark cursor as being dead and notified

setCursorNotified()

Mark cursor as being notified

Type Definitions

ReadConcernObject

The MongoDB ReadConcern, which allows for control of the consistency and isolation properties
of the data read from replica sets and replica set shards.

Properties:
Name Type Description
level 'local' | 'available' | 'majority' | 'linearizable' | 'snapshot'

The readConcern Level

See:

resultCallback(error, document)

This is a cursor results callback

Name Type Description
error error

An error object. Set to null if no error present

document object

SessionIdObject

A BSON document reflecting the lsid of a ClientSession

SessionOptionsObject

Options to pass when creating a Client Session

Properties:
Name Type Argument Default Description
causalConsistency boolean <optional>
true

Whether causal consistency should be enabled on this session

defaultTransactionOptions TransactionOptions <optional>

The default TransactionOptions to use for transactions started on this session.

TransactionOptionsObject

Configuration options for a transaction.

Properties:
Name Type Argument Description
readConcern ReadConcern <optional>

A default read concern for commands in this transaction

writeConcern WriteConcern <optional>

A default writeConcern for commands in this transaction

readPreference ReadPreference <optional>

A default read preference for commands in this transaction

WithTransactionCallback(session){Promise}

A user provided function to be run within a transaction

Name Type Description
session ClientSession

The parent session of the transaction running the operation. This should be passed into each operation within the lambda.

Returns:
resulting Promise of operations run within this transaction

WriteConcernObject

A MongoDB WriteConcern, which describes the level of acknowledgement
requested from MongoDB for write operations.

Properties:
Name Type Argument Default Description
w number | 'majority' | string <optional>
1

requests acknowledgement that the write operation has
propagated to a specified number of mongod hosts

j boolean <optional>
false

requests acknowledgement from MongoDB that the write operation has
been written to the journal

wtimeout number <optional>

a time limit, in milliseconds, for the write concern

See: