Docs Menu
Docs Home
/ / /
Node.js Driver

What's New

On this page

  • What's New in 6.5
  • What's New in 6.4
  • What's New in 6.3
  • What's New in 6.2
  • What's New in 6.1
  • What's New in 6.0

Learn what's new in:

  • Version 6.5

  • Version 6.4

  • Version 6.3

  • Version 6.2

  • Version 6.1

  • Version 6.0

The Node.js driver v6.5 release includes the following features:

  • Updates bulk write operations to use the pkFactory class for document ID generation.

Warning

If you previously specified an instance of a pkFactory to handle bulk writes, the _id fields of the documents inserted by using bulk writes may be inconsistent with the behavior in this version.

  • Fixes the read preference that is sent with read operations to primaryPreferred when the driver is connected to a secondary node in the replica set.

  • Fixes a memory leak in promise creation for socket operations.

  • Reduces first-time connection latency when connecting to a DNS seedlist by querying the SRV and TXT records in parallel.

  • Adds tracking to container metadata when running a client in Kubernetes or a container environment in the client.env.container field of the handshake document.

  • Adds the original error document returned by the server to the errorResponse field of the MongoServerError document.

  • Deprecates the CloseOptions interface which is unused by the driver.

To learn more about this release, see the v6.5.0 Release Highlights on GitHub.

The Node.js driver v6.4 release includes the following features:

  • When multiple mongos instances are available, different servers are used for read and write retry attempts.

  • Caches AWS credentials at the client level, rather than for each authentication.

  • Upgrades to using BSON 6.4.0. For details about the new BSON features, see the release notes for BSON 6.3.0 and BSON 6.4.0.

  • Read operations that result in an ExceededTimeLimit error are retried.

  • Fixes a request issue related to TLS sockets and KMS Providers.

  • Fixes the base64 padding on the saslContinue command to allow for mongosh authentication.

  • Types countDocuments using Filter<Schema> rather than Document, which enables autocompletion and helps prevent downstream typing issues.

  • Fixes a type error in the $addToSet option of the bulkWrite command. The driver skips $addToSet validation you extend your types from Document or any, or use properties of any type.

  • Fixes the ServerHeartbeatSucceeded and ServerHeartbeatFailed event heartbeat duration so that it does not include the time to create the socket.

  • Appropriately emits errors from cursor transform streams, rather than absorbing them.

  • Makes AWS session tokens optional when a username and password are provided, and allows AWS SDK to handle the authentication requests.

To learn more about this release, see the v6.4.0 Release Highlights on GitHub.

The Node.js driver v6.3 release includes the following features:

  • Adds the serverMonitoringMode client option to control the behavior of the monitoring connection among the nodes in a topology. This option takes a value of auto (default), poll, or stream. To learn more, see the entry for this option in the Connection Options guide.

    You can set the serverMonitoringMode option in a MongoClientOptions instance or as a connection string option. The following example shows how to create a client with the option set to stream:

    new MongoClient('<connection string>', { serverMonitoringMode: 'stream' });
  • Fixes a connection leak when the serverApi client option is set.

  • Deprecates the contentType and aliases GridFS options. To store the content type and aliases of a file, add contentType and aliases fields to the metadata document.

To learn more about this release, see the v6.3.0 Release Highlights.

The Node.js driver v6.2 release includes the following features:

  • Updates the bson package version to 6.2.0 to include color visualization of types, as shown in the following image:

    A screenshot of the terminal that shows printing in color

    To learn more, see the bson v6.2.0 release notes.

  • Ensures that the result.insertedIds property of a bulk write error type contains the _id values of successfully inserted documents. In previous versions, when a bulk write operation rejected an insert operation, the result.insertedIds property contained the _id values for all attempted inserts.

  • Closes the implicit session created when running the findOne() method on a time series collection regardless of the outcome of the operation.

  • Allows the creation of collections that have names that start or end with the . character. This change aligns the driver's database and collection name-checking behavior with the server's.

To learn more about this release, see the v6.2.0 Release Highlights.

The Node.js driver v6.1 release includes the following features:

  • Updates the bson package version to 6.1.0 to expose the Decimal128.fromStringWithRounding() method. To learn more, see the v6.1.0 bson release notes.

  • Detects environment variables for region settings when you authenticate by using the IAM AssumeRoleWithWebIdentity action with MONGODB-AWS authentication. To instruct the driver to use your region options, you must set both of the following environment variables:

    • AWS_STS_REGIONAL_ENDPOINTS

    • AWS_REGION

    To learn how to set region settings when using the MONGODB-AWS authentication mechanism, see the Web Identity Token tab in the MONGODB-AWS section of the Authentication Mechanisms guide.

  • Fixes a memory leak issue caused by recursive calls to the next() method of the ChangeStream type.

To learn more about this release, see the v6.1.0 Release Highlights.

Warning

Breaking Changes in v6.0

This driver version introduces breaking changes. For a list of these changes, see the Version 6.0 Breaking Changes section in the Upgrade guide.

The Node.js driver v6.0 release includes the following features:

Important

Deprecation Notice

All of the ssl-prefixed options in the MongoClientOptions type are deprecated. In addition, the tlsCertificateFile option is deprecated.

Instead, you should store your certificates in a SecureContext object or set the tls-prefixed options in your MongoClientOptions instance. To learn more, see Enable TLS on a Connection.

  • Removal of support for the addUser() helper command. Use the createUser MongoDB Shell command instead.

  • Removal of support for the collStats operation. Use the $collStats aggregation operator instead.

  • The options field of the ConnectionPoolCreatedEvent type contains only the following fields, which are the non-default pool options:

    • maxConnecting

    • maxPoolSize

    • minPoolSize

    • maxIdleTimeMS

    • waitQueueTimeoutMS

  • The driver asynchronously reads files set in the tlsCAFile and tlsCertificateKeyFile connection options when you call the MongoClient.connect() method, not when you create a MongoClient instance.

  • Removal of the keepAlive and keepAliveInitialDelay connection options. The value of keepAlive is permanently set to true and the value of keepAliveInitialDelay is set to 300000 milliseconds (300 seconds).

    To learn how to set keepalive settings at a system level, see the Does TCP keepalive time affect MongoDB Deployments? FAQ entry in the Server manual.

  • Removes the following options for the Db.command() method:

    • willRetryWrite

    • omitReadPreference

    • writeConcern

    • explain

    • readConcern

    • collation

    • maxTimeMS

    • comment

    • retryWrites

    • dbName

    • authdb

    • noResponse

    Although you cannot pass these options to the Db.command() method, you can still set them in the command document. To learn more, see the Command Options section of the Run a Command guide.

To learn more about this release, see the v6.0.0 Release Highlights.

Back

Quick Reference