Global

Type Definitions

AutoEncryptionOptionsObject

Configuration options for a automatic client encryption.

NOTE: Support for client side encryption is in beta. Backwards-breaking changes may be made before the final release.

Properties:
Name Type Argument Description
keyVaultClient MongoClient <optional>

A MongoClient used to fetch keys from a key vault

keyVaultNamespace string <optional>

The namespace where keys are stored in the key vault

kmsProviders object <optional>

Provider details for the desired Key Management Service to use for encryption

Properties
Name Type Argument Description
aws object <optional>

Optional settings for the AWS KMS provider

Properties
Name Type Argument Description
accessKeyId string <optional>

The access key used for the AWS KMS provider

secretAccessKey string <optional>

The secret access key used for the AWS KMS provider

local object <optional>

Optional settings for the local KMS provider

Properties
Name Type Argument Description
key string <optional>

The master key used to encrypt/decrypt data keys

schemaMap object <optional>

A map of namespaces to a local JSON schema for encryption

bypassAutoEncryption boolean <optional>

Allows the user to bypass auto encryption, maintaining implicit decryption

extraOptions object <optional>

Extra options related to the mongocryptd process

Properties
Name Type Argument Default Description
mongocryptURI string <optional>

A local process the driver communicates with to determine how to encrypt values in a command. Defaults to "mongodb://%2Fvar%2Fmongocryptd.sock" if domain sockets are available or "mongodb://localhost:27020" otherwise

mongocryptdBypassSpawn boolean <optional>
false

If true, autoEncryption will not attempt to spawn a mongocryptd before connecting

mongocryptdSpawnPath string <optional>

The path to the mongocryptd executable on the system

mongocryptdSpawnArgs Array.<string> <optional>

Command line arguments to use when auto-spawning a mongocryptd

ChangeStreamOptions

Options that can be passed to a ChangeStream. Note that startAfter, resumeAfter, and startAtOperationTime are all mutually exclusive, and the server will error if more than one is specified.

Properties:
Name Type Argument Default Description
fullDocument string <optional>
'default'

Allowed values: ‘default’, ‘updateLookup’. When set to ‘updateLookup’, the change stream will include both a delta describing the changes to the document, as well as a copy of the entire document that was changed from some time after the change occurred.

maxAwaitTimeMS number <optional>

The maximum amount of time for the server to wait on new documents to satisfy a change stream query.

resumeAfter ResumeToken <optional>

Allows you to start a changeStream after a specified event. See ChangeStream documentation.

startAfter ResumeToken <optional>

Similar to resumeAfter, but will allow you to start after an invalidated event. See ChangeStream documentation.

startAtOperationTime OperationTime <optional>

Will start the changeStream after the specified operationTime.

batchSize number <optional>
1000

The number of documents to return per batch. See aggregation documentation.

collation object <optional>

Specify collation settings for operation. See aggregation documentation.

readPreference ReadPreference <optional>

The read preference. Defaults to the read preference of the database or collection. See read preference documentation.

DriverInfoOptionsObject

Configuration options for drivers wrapping the node driver.

Properties:
Name Type Argument Description
name string <optional>

The name of the driver

version string <optional>

The version of the driver

platform string <optional>

Optional platform information

OperationTime

Represents a specific point in time on a server. Can be retrieved by using Db#command

See:

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:

ReadConcernLevel'local' 'available' 'majority' 'linearizable' 'snapshot'

A string specifying the level of a ReadConcern

See:

ResumeToken

Represents the logical starting point for a new or resuming ChangeStream on the server.

See:

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: