NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
npm · #3169 most downloaded on npm
The official MongoDB driver for Node.js
Last release today
04 Oct 2026
Ships on a steady schedule
a new release about every 8 days
Nearly every release is documented
notes for 60 of the last 60 stable releases
195 versions withdrawn
withdrawn after publishing
15 years old
922 releases · first in 2011
Nothing published for this version
Nothing published for this version
Nothing published for this version
One column per quarter.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
The limit , noCursorResponse and batchSize options have also been deprecated, and the command will guarantee no more cursors can be orphaned and no ki…
The MongoDB Node.js team is pleased to announce version 6.19.0 of the mongodb package!
Important
Substring, prefix and suffix search are in preview and should be used for experimental workloads only. These features are unstable and their security is not guaranteed until released as Generally Available (GA). The GA version of these features may not be backwards compatible with the preview version.
When using Queryable Encryption with both automatic encryption and explicit encryption, text fields can now be queried using prefix, suffix and substring queries. This feature requires mongodb-client-encryption@>=6.5.0.
secureContext for Auto Encryption and Client Encryption TLS optionsThis can be provided in the tlsOptions option both both objects.
import * as tls from 'tls';
import { ClientEncryption, MongoClient } from 'mongodb';
const caFile = await fs.readFile(process.env.CSFLE_TLS_CA_FILE);
const certFile = await fs.readFile(process.env.CSFLE_TLS_CLIENT_CERT_FILE);
const secureContextOptions = {
ca: caFile,
key: certFile,
cert: certFile
};
const options = {
keyVaultNamespace: 'db.coll',
kmsProviders: {
aws: {}
}
},
tlsOptions: {
aws: {
secureContext: tls.createSecureContext(secureContextOptions),
}
}
};
const client = this.configuration.newClient({}, { autoEncryption: { ...options, schemaMap } });
const clientEncryption = new ClientEncryption(client, options);collection.findOne() and collection.find() will no longer potentially leave open cursors on the serverThe findOne command will now always set the limit option to 1 and singleBatch to true. The limit, noCursorResponse and batchSize options have also been deprecated, and the command will guarantee no more cursors can be orphaned and no killCursors command will be potentially executed.
find will now set limit to batchSize + 1 when both options were equal, to avoid leaving cursors open.
When authentication is enabled, the MongoClient will no longer send a ping command when connecting since it is unnecessary. Instead it will check a connection out of the pool to force the initial handshake, and check it back in.
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
NODE-7053: deprecate noResponse option
The MongoDB Node.js team is pleased to announce version 6.18.0 of the mongodb package!
appendMetadata API allows clients to add handshake metadata post constructionDriver information such as name, version, and platform are allowed:
import { MongoClient } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI);
client.appendMetadata({ name: 'my library', version: '1.0', platform: 'NodeJS' });
In previous versions, sessions were eagerly allocated whenever a cursor was created, regardless of whether or not a cursor was actually iterated (and the session was actually needed). Some driver APIs (FindCursor.count(), AggregationCursor.explain() and FindCursor.explain()) don't actually iterate the cursor they are executed on. This can lead to client sessions being created and never being cleaned up.
With this update, sessions are not allocated until the cursor is iterated.
minPoolSize=0A MongoClient configured with a maxIdleTimeMS and minPoolSize of 0 is advantageous for workloads that have sustained periods of little or no activity because it allows the connection pool to close connections that are unused during these periods of inactivity. However, due to a bug in the ConnectionPool implementation, idle / perished connections were not cleaned up unless minPoolSize was non-zero.
With the changes in this PR, the ConnectionPool now always cleans up idle connections, regardless of minPoolSize.
wallTime propertyThis property is available on all types with the exception of reshard collection and refine collection shard key events. Thanks to @qhello for bringing this bug to our attention!
CommandSucceededEvent and CommandFailedEvent events now have a databaseName propertyCommandSucceededEvent and CommandFailedEvent now include the name of the database against which the command was executed.
These were for internal use only and include:
Transaction#options
Transaction#recoveryToken
Transaction#isPinned
Transaction#isStarting
Transaction#isActive
Transaction#isCommitted
ClientMetadata, ClientMetadataOptions, and CancellationToken have been deprecatedThese types will be removed in an upcoming major version of the driver.
CommandOptions.noResponse is deprecated[!CAUTION]
noResponseis not intended for use outside ofMongoClient.close(). Do not use this option.
The Node driver has historically supported an option, noResponse, that is used internally when a MongoClient is closed. This option was accidentally public. This option will be removed in an upcoming major release.
wallTime property TS change stream event interfaces (#4541) (f153c6f)We invite you to try the mongodb library immediately, and report any issues to the NODE project.
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
Nothing published for this version
The MongoDB Node.js team is pleased to announce version 6.17.0 of the mongodb package!
The MongoDB Node.js team is pleased to announce version 6.17.0 of the mongodb package!
[!WARNING] When the driver connects to a MongoDB server of version 4.0 or less, it will now throw an error.
This resolves issues of a cached OIDC token in the driver causing initial authentication to fail when the token had expired. The affected environments were "azure", "gcp", and "k8s".
keepAliveInitialDelay may now be configured at the MongoClient levelWhen not present will default to 120 seconds. The option value must be specified in milliseconds.
import { MongoClient } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI, { keepAliveInitialDelay: 100000 });
updateOne and replaceOne now support a sort optionThe updateOne and replaceOne operations in each of the ways they can be performed support a sort option starting in MongoDB 8.0. The driver now supports the sort option the same way it does for find or findOneAndModify-style commands:
const sort = { fieldName: -1 };
collection.updateOne({}, {}, { sort });
collection.replaceOne({}, {}, { sort });
collection.bulkWrite([
{ updateOne: { filter: {}, update: {}, sort } },
{ replaceOne: { filter: {}, replacement: {}, sort } },
]);
client.bulkWrite([
{ name: 'updateOne', namespace: 'db.test', filter: {}, update: {}, sort },
{ name: 'replaceOne', namespace: 'db.test', filter: {}, replacement: {}, sort }
]);
The MongoClient.close() method now shuts connections that are in-use allowing the event loop to close if the only remaining resource was the MongoClient.
Default value is 60000. Requires using mongodb-client-encryption >= 6.4.0
For ClientEncryption:
import { MongoClient, ClientEncryption } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI);
const clientEncryption = new ClientEncryption(client, { keyExpirationMS: 100000, kmsProviders: ... });
For auto encryption:
import { MongoClient, ClientEncryption } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI, {
autoEncryption: {
keyExpirationMS: 100000,
kmsProviders: ...
}
});
ignoreUndefined is true and all operations are undefined.When using any of the following operations they will now throw if all atomic operations in the update are undefined and the ignoreUndefined option is true. This is to avoid accidental replacement of the entire document with an empty document. Examples of this scenario:
import { MongoClient } from 'mongodb';
const client = new MongoClient(process.env.MONGODB_URI);
client.bulkWrite(
[
{
name: 'updateMany',
namespace: 'foo.bar',
filter: { age: { $lte: 5 } },
update: { $set: undefined, $unset: undefined }
}
],
{ ignoreUndefined: true }
);
const collection = client.db('test').collection('test');
collection.bulkWrite(
[
{
updateMany: {
filter: { age: { $lte: 5 } },
update: { $set: undefined, $unset: undefined }
}
}
],
{ ignoreUndefined: true }
);
collection.findOneAndUpdate(
{ a: 1 },
{ $set: undefined, $unset: undefined },
{ ignoreUndefined: true }
);
collection.updateOne({ a: 1 }, { $set: undefined, $unset: undefined }, { ignoreUndefined: true });
collection.updateMany({ a: 1 }, { $set: undefined, $unset: undefined }, { ignoreUndefined: true });
Network errors perform an important role in the driver, impacting topology monitoring processes and retryablity. A bug in the driver's socket implementation meant that in scenarios where server disconnects occurred while no operation was in progress on the socket resulted in errors that were not considered network errors.
Socket errors are now unconditionally treated as network errors.
We invite you to try the mongodb library immediately, and report any issues to the NODE project.
Nothing published for this version
Your coding agent can read these notes before it upgrades. Set up the MCP server →