Methods
-
addToOperationsList(bulkOperation, docType, document){OrderedBulkOperation}
-
Add to internal list of Operations
Name Type Description bulkOperation
OrderedBulkOperation docType
number number indicating the document type
document
object -
addToOperationsList(bulkOperation, docType, document){UnorderedBulkOperation}
-
Add to internal list of Operations
Name Type Description bulkOperation
UnorderedBulkOperation docType
number number indicating the document type
document
object -
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
-
handleMongoWriteConcernError(batch, bulkResult, ordered, err, callback)
-
handles write concern error
Name Type Description batch
object bulkResult
object ordered
boolean err
WriteConcernError callback
function -
isRetryableError(error)
-
Determines whether an error is something the driver should attempt to retry
Name Type Description error
MongoError | Error
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.- See:
Properties:
Name Type Description level
'local' | 'available' | 'majority' | 'linearizable' | 'snapshot' The readConcern Level
-
ReadConcernLevel'local' 'available' 'majority' 'linearizable' 'snapshot'
-
A string specifying the level of a ReadConcern
-
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.- See:
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 hostsj
boolean <optional>
false requests acknowledgement from MongoDB that the write operation has
been written to the journalwtimeout
number <optional>
a time limit, in milliseconds, for the write concern