# MongoDB Node.js Driver changelog > The official MongoDB driver for Node.js. - Vendor: MongoDB - Category: Databases & Data - Official site: https://github.com/mongodb/node-mongodb-native - Tracked by: What's New (https://whatsnew.fyi/product/mongodb-node-driver) - Harvested from: GitHub (mongodb/node-mongodb-native) - Entries below: 10 (newest first) What's New is an index, not a publisher: every entry below links to the vendor's own release notes, which are the authoritative source. Entries are labelled where they are hand-curated sample data, pre-releases, or drawn from a secondary source such as a developer blog. Reuse: the summaries, labels and curation here are © What's New. Quote freely with attribution and a link back; wholesale republication of the corpus is not permitted — terms: https://whatsnew.fyi/terms. The vendors' own release notes remain their publishers'. ## Releases ### v7.5.0 - Date: 2026-07-07 - Version: v7.5.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.5.0 - **added** — Support for Queryable Encryption string queries in MongoDB 9.0 with exact and range-style string matching against encrypted fields - **changed** — TextOpts API is replaced with StringOpts - **changed** — TextPreview algorithm is replaced with String - **deprecated** — prefixPreview, suffixPreview, and substringPreview query types are deprecated and will be removed in a future release - **fixed** — MongoClient.close() now closes checked-out connections on all servers in replica sets and sharded clusters ##### [7.5.0](https://github.com/mongodb/node-mongodb-native/compare/v7.4.0...v7.5.0) (2026-07-07) The MongoDB Node.js team is pleased to announce version 7.5.0 of the `mongodb` package! ##### Release Notes ###### Support for Queryable Encryption String Query GA in MongoDB 9.0 Queryable Encryption string queries are now available for MongoDB 9.0. Building on the technical preview introduced in earlier releases, this feature lets you run exact and range-style string matching against encrypted fields. As part of the promotion to GA, the API has been renamed: - The `TextOpts` API is replaced with `StringOpts`. - The `TextPreview` algorithm is replaced with `String`. - The `prefix`, `suffix`, and `substring` query types are now generally available. - The `prefixPreview`, `suffixPreview`, and `substringPreview` query types are deprecated and will be removed in a future release. ###### MongoClient.close() now closes in-use connections on all servers Since v6.17.0, `MongoClient.close()` has eagerly closed checked-out (in-use) connections so that in-flight operations are interrupted promptly with a `MongoClientClosedError` instead of holding the client open. However, due to a bug, on replica sets and sharded clusters operations in flight on other servers were not interrupted, and their connections stayed open until the operations completed on their own. Calls to closeCheckedOutConnections() will now ensure all checked out connections are closed across all servers. Thank you to @Nepomuk5665 and @sarthaksoni25 for bringing this to our attention/providing an initial implementation! ###### Features * **NODE-7537:** promote QE string queries (prefix/suffix/substring) ([#4996](https://github.com/mongodb/node-mongodb-native/issues/4996)) ([dc4900c](https://github.com/mongodb/node-mongodb-native/commit/dc4900c36207d70b718c6fc013c5233ceb9f343c)) ###### Bug Fixes * **NODE-7411:** iterate all servers on close ([#4967](https://github.com/mongodb/node-mongodb-native/issues/4967)) ([72c0296](https://github.com/mongodb/node-mongodb-native/commit/72c02969f49ebc239dd15ef3deaf9be15fbbb94f)) ##### Documentation * [Reference](https://docs.mongodb.com/drivers/node/current/) * [API](https://mongodb.github.io/node-mongodb-native/7.5/) * [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v7.5.0/HISTORY.md) We invite you to try the `mongodb` library immediately, and report any issues to the [NODE project](https://jira.mongodb.org/projects/NODE). ### v7.4.0 - Date: 2026-06-25 - Version: v7.4.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.4.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.4.0 - **changed** — Remove experimental tag from Symbol.asyncDispose methods on MongoClient, ClientSession, ChangeStream, and cursors to mark explicit resource management as stable - **changed** — Send afterClusterTime on writes in causally-consistent sessions to maintain read your own writes guarantee across primary failovers in sharded clusters ##### [7.4.0](https://github.com/mongodb/node-mongodb-native/compare/v7.3.0...v7.4.0) (2026-06-25) The MongoDB Node.js team is pleased to announce version 7.4.0 of the `mongodb` package! ##### Release Notes ###### Explicit resource management is now stable The `Symbol.asyncDispose` methods on `MongoClient`, `ClientSession`, `ChangeStream`, and cursors enable `await using` for automatic cleanup. These methods were introduced as experimental in v6.9.0. Since then, TC39 Explicit Resource Management proposal reached Stage 4 in 2025, and Node.js enabled explicit resource management as a stable feature in Node.js 24, so the experimental flags have been removed from our APIs and the APIs are now officially supported. ###### afterClusterTime now sent on writes in causally-consistent sessions When a session has causal consistency enabled, write operations now include `readConcern.afterClusterTime`, matching the existing read behavior. This maintains the "read your own writes" guarantee across primary failovers in shareded clusters. There are no API changes. ###### Features * **NODE-7634:** remove experimental tag from async dispose methods ([#4976](https://github.com/mongodb/node-mongodb-native/issues/4976)) ([43ce3eb](https://github.com/mongodb/node-mongodb-native/commit/43ce3ebb701bf24af797d24e81788b576dccf1a9)) * **NODE-7549:** send afterClusterTime on writes in causally-consistent sessions ([#4963](https://github.com/mongodb/node-mongodb-native/issues/4963)) ([3abfd26](https://github.com/mongodb/node-mongodb-native/commit/3abfd263c5da2eaa5c223a0d5b9b440a1e1d4cf6)) ##### Documentation * [Reference](https://docs.mongodb.com/drivers/node/current/) * [API](https://mongodb.github.io/node-mongodb-native/7.4/) * [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v7.4.0/HISTORY.md) We invite you to try the `mongodb` library immediately, and report any issues to the [NODE project](https://jira.mongodb.org/projects/NODE). ### v7.3.0 - Date: 2026-06-09 - Version: v7.3.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.3.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.3.0 - **changed** — Bump maxWireVersion to 29 in preparation for MongoDB LTS v9.0 - **fixed** — Fix SCRAM authentication for non-Node.js runtimes such as Deno by using explicit UTF-8 string conversion instead of implicit toString() calls on byte arrays > [!IMPORTANT] > A future minor release will raise the minimum supported MongoDB Server version from 4.2 to 4.4. This is in accordance with [MongoDB Software Lifecycle Schedules](https://www.mongodb.com/legal/support-policy/lifecycles). Support for MongoDB Server 4.2 will be dropped in a future release! ##### [7.3.0](https://github.com/mongodb/node-mongodb-native/compare/v7.2.0...v7.3.0) (2026-06-04) The MongoDB Node.js team is pleased to announce version 7.3.0 of the `mongodb` package! ##### Release Notes ###### `maxWireVersion` is bumped to `29` Max wire version & max server version bumped in preparation for MongoDB LTS (v9.0). ###### Fixed SCRAM authentication for non-Node.js runtimes (e.g., Deno) SCRAM-based authentication (the default mechanism for username/password connections) was broken when using the driver in non-Node.js environments such as Deno. The root cause was an implicit `toString()` call on byte arrays that produced incorrect output outside of Node.js. This fix ensures explicit UTF-8 string conversion is used throughout the SCRAM implementation, restoring authentication in Deno and other web-compatible runtimes. ###### Features * **NODE-7518:** bump maxWireVersion ([#4950](https://github.com/mongodb/node-mongodb-native/issues/4950)) ([4447050](https://github.com/mongodb/node-mongodb-native/commit/444705061ae49973a432fbcb0098419b72b75409)) ###### Bug Fixes * **NODE-7548:** SCRAM authentication fails on non-Node runtimes ([#4932](https://github.com/mongodb/node-mongodb-native/issues/4932)) ([a10d2c9](https://github.com/mongodb/node-mongodb-native/commit/a10d2c937eaa2bfb30aece513c9770ec55541280)) ##### Documentation * [Reference](https://docs.mongodb.com/drivers/node/current/) * [API](https://mongodb.github.io/node-mongodb-native/7.3/) * [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v7.3.0/HISTORY.md) We invite you to try the `mongodb` library immediately, and report any issues to the [NODE project](https://jira.mongodb.org/projects/NODE). ### v7.2.0 - Date: 2026-04-20 - Version: v7.2.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.2.0 - **added** — Support for MongoDB's Intelligent Workload Management with graceful handling of write-blocking scenarios and optimized connection establishment during high-load conditions - **added** — New client option `maxAdaptiveRetries` (default: 2) to configure the maximum number of retries during server overload - **added** — New client option `enableOverloadRetargeting` (default: false) to deprioritize servers that return overload errors during retry server selection - **added** — Experimental `runtimeAdapters` client option to allow injection of core Node.js APIs for use in alternative runtimes and restricted environments - **added** — Support for injecting Node.js `os` module via `runtimeAdapters` - **added** — Add `bufferedCount()` method to ChangeStream to return the number of documents remaining in the change stream from the last batch - **changed** — Replace Node-specific Buffer APIs with standard Uint8Array APIs - **changed** — Replace Node-specific crypto API with standard Web Crypto API `globalThis.crypto` - **changed** — Implement exponential backoff and jitter in retry loops ##### [7.2.0](https://github.com/mongodb/node-mongodb-native/compare/v7.1.0...v7.2.0) (2026-04-17) The MongoDB Node.js team is pleased to announce version 7.2.0 of the `mongodb` package! ##### Release Notes ###### ⚙️ Added support for MongoDB's Intelligent Workload Management Added support for MongoDB's [Intelligent Workload Management IWM and ingress connection rate limiting features. The driver now gracefully handles write-blocking scenarios and optimizes connection establishment during high-load conditions to maintain application availability. Two new client options are available: - `maxAdaptiveRetries` (default: 2) - configures the maximum number of retries during server overload. Set to 0 to disable overload retries. - `enableOverloadRetargeting` (default: false) - when enabled, the driver will deprioritize servers that return overload errors during retry server selection. These features will be functional with MongoDB Atlas Server Version 9.0 and above. ###### 🧩 Runtime and platform compatibility improvements ###### Node-specific platform APIs replaced with standards-based equivalents The following Node-specific APIs have been replaced with standards-based equivalents: - The driver now uses the standard `Uint8Array` APIs instead of the Node‑specific `Buffer` APIs. - The driver now uses the standard Web Crypto API `globalThis.crypto` instead of the Node‑specific `crypto` API. These changes reduce the number of patches required to run the driver outside of Node.js and improve compatibility with non-Node.js runtimes. ###### Experimental Support for Dependency Injection of Nodejs Runtime Dependencies This release introduces a new MongoClient option, `runtimeAdapters`. `runtimeAdapters` allows injection of core Nodejs APIs, to allow users of the driver to use alternative runtimes that don't support Nodejs compatibility or work in restricted environments. > [!WARNING] > `runtimeAdapters` is experimental and the actual interface of each dependency might change at any time. Notes about usage of `runtimeAdapters`: 1. If no `runtimeAdapter` is provided for a core Nodejs module that the driver uses, the driver will import the corresponding module from Nodejs. 2. Adapters are per-client. 3. Each adapter specifies the required APIs as a part of its Typescript API definition. There are no runtime checks to ensure all required functions are provided; the onus is on users to ensure that all required module dependencies are provided. 4. The `runtimeAdapters` Typescript types currently rely on Nodejs' type definitions (`@types/node`). To use `runtimeAdapters` in a Typescript project, `@types/node` must be installed as well. 5. When providing a module in `runtimeAdapters`, all required functions inside that module must be provided. For example, when injecting the `os` module, the `platform()` function cannot be omitted. ###### `runtimeAdapters` supports injecting Nodejs' `os` module The `os` module is pluggable using `runtimeAdapters`: ```typescript const os: OsAdapter = { // implement the required OSAdapter interface } // `client` will never import or make use of the `os` module and instead only rely on the `os` adapter specified above. const client = new MongoClient(, { runtimeAdapters: { os } }); ``` ###### ☀️ ChangeStreams now have a `bufferedCount()` method that matches cursors In some circumstances it may be desirable to determine if there are local documents stored in your change stream before invoking one of the async methods (`tryNext`, `hasNext` etc.). The `changeStream.bufferedCount()` returns the number of documents remaining inside the change stream from the last batch. Shout out to @typesafe for contributing this feature! ###### Features * **NODE-7315:** Use BSON ByteUtils instead of Nodejs Buffer ([#4840](https://github.com/mongodb/node-mongodb-native/issues/4840)) ([1add538](https://github.com/mongodb/node-mongodb-native/ _[Truncated at 4000 characters — full notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0]_ ### v7.1.1 - Date: 2026-03-24 - Version: v7.1.1 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.1 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.1.1 - **fixed** — Tighten OIDC ALLOWED_HOSTS wildcard matching to require full subdomain/path matches for *. and */ entries, preventing partial suffix matches from being incorrectly accepted - **fixed** — Apply TCP keep-alive and no-delay settings on TLS connections by explicitly calling setKeepAlive() and setNoDelay() on the socket after creation ##### [7.1.1](https://github.com/mongodb/node-mongodb-native/compare/v7.1.0...v7.1.1) (2026-03-24) The MongoDB Node.js team is pleased to announce version 7.1.1 of the `mongodb` package! ##### Release Notes ###### Tighten OIDC ALLOWED_HOSTS wildcard matching The OIDC ALLOWED_HOSTS wildcard handling has been fixed to require full subdomain/path matches for *. and */ entries, preventing partial suffix matches from being incorrectly accepted. ###### Fixed TCP keep-alive and no-delay settings not being applied on TLS connections Due to a [Node.js bug](https://github.com/nodejs/node/issues/62003), `tls.connect()` silently ignores `keepAlive`, `keepAliveInitialDelay`, and `noDelay` options passed through its constructor. This could cause idle connections - particularly through cloud load balancers like Azure (240s idle timeout) or AWS PrivateLink/NLB - to be dropped unexpectedly due to missing TCP keep-alive probes. The driver now explicitly calls `setKeepAlive()` and `setNoDelay()` on the socket after creation, ensuring these settings are always applied regardless of whether TLS is used. ###### Bug Fixes * **NODE-7477:** OIDC host allowlist fix ([#4896](https://github.com/mongodb/node-mongodb-native/issues/4896)) ([237c9ab](https://github.com/mongodb/node-mongodb-native/commit/237c9abf26e78d6d059b5f31177b25d4ab7e4e89)) * **NODE-7482:** explicitly call setKeepAlive and setNoDelay on socket ([#4900](https://github.com/mongodb/node-mongodb-native/issues/4900)) ([b14ba21](https://github.com/mongodb/node-mongodb-native/commit/b14ba210783a62d475086bb739a75bc7f5db37f1)) ##### Documentation * [Reference](https://docs.mongodb.com/drivers/node/current/) * [API](https://mongodb.github.io/node-mongodb-native/7.1/) * [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v7.1.1/HISTORY.md) We invite you to try the `mongodb` library immediately, and report any issues to the [NODE project](https://jira.mongodb.org/projects/NODE). ### v7.1.0 - Date: 2026-02-04 - Version: v7.1.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.1.0 - **removed** — aws4 package is no longer required for AWS authentication - **changed** — Driver no longer relies on Node.js util.promisify() API for improved compatibility with alternate runtimes - **changed** — Driver now explicitly imports node:process instead of relying on global.process - **changed** — Replace process.arch with os.arch() - **changed** — Replace process.platform with os.platform() - **changed** — Replace os.endianness() with BSON.NumberUtils - **changed** — Replace process.hrtime() with performance.now() - **changed** — Replace process.nextTick() with queueMicrotask() - **fixed** — Connection establishment failures no longer clear the pool, preventing unnecessary connection churn in server overload scenarios - **changed** — withTransaction now applies exponential backoff during transaction retries - **changed** — Server selection deprioritizes servers during retries - **changed** — OIDC authentication now supports hosts matching *.mongo.com in its default ALLOWED_HOSTS list - **fixed** — OIDC reauthentication now works with promoteValues: false - **fixed** — Aggregations with write stages now correctly respect secondary and secondaryPreferred read preferences due to corrected commonWireVersion initialization - **deprecated** — RenameCollectionOptions.new_collection option is deprecated and will be removed in a future major release ##### [7.1.0](https://github.com/mongodb/node-mongodb-native/compare/v7.0.0...v7.1.0) (2026-02-02) The MongoDB Node.js team is pleased to announce version 7.1.0 of the `mongodb` package! ##### Release Notes ###### 🧩 Runtime and platform compatibility improvements ###### `aws4` package no longer required for AWS authentication The [aws4](https://www.npmjs.com/package/aws4) package is no longer required to use AWS authentication, reducing the dependency footprint. ###### Usages of `util.promisify` have been removed The driver no longer relies on Node.js’s `util.promisify()` API, which improves compatibility with alternate runtimes. ###### Explicit `node:process` import instead of `global.process` The driver now explicitly imports `node:process` instead of relying on `global.process`, allowing bundlers and alternate runtimes to supply and optimize the `process` implementation more consistently. ###### Node-specific platform APIs replaced with standards-based equivalents The driver replaces several Node-specific APIs with standards-based equivalents: - `process.arch` → `os.arch()` - `process.platform` → `os.platform()` - `os.endianness()` → `BSON.NumberUtils` - `process.hrtime()` → `performance.now()` - `process.nextTick()` → `queueMicrotask()` These changes reduce the number of patches required to run the driver outside of Node.js and improve compatibility with non-Node.js runtimes. ###### 🔁 Connection resilience and retry behavior improvements ###### Connection churn avoidance in server overload scenarios When [server-side connection rate limiting](https://www.mongodb.com/docs/manual/reference/parameters/#mongodb-parameter-param.ingressConnectionEstablishmentRateLimiterEnabled) is enabled and the rate limiter kicks in under periods of high connection establishment,the driver will additionally churn connections by clearing the pool every time the rate limiter rejects an incoming connection request. In this new driver release, connection establishment failures no longer clear the pool, preventing unnecessary connection churn in these scenarios. ###### `withTransaction` now applies exponential backoff during transaction retries The convenient transaction API, `withTransaction`, now uses exponential backoff between retries when a transaction must be retried. Under high server load, this can help prevent transaction retry storms. ###### Server selection deprioritizes servers during retries When retrying a command, the driver now deprioritizes servers during server selection, improving stability and reducing the likelihood of repeatedly targeting overloaded or previously failed servers. ###### 🔐 OIDC authentication improvements ###### Expanded the list of `ALLOWED_HOSTS` for OIDC OIDC authentication now supports hosts matching `*.mongo.com` in its default `ALLOWED_HOSTS` list. ###### OIDC reauthentication now works with `promoteValues: false` When `MongoClient` is configured with `promoteValues: false` (for applications that rely on raw BSON types), OIDC reauthentication now succeeds as expected. ###### ✅ Fixed read preference adherence for `$merge` and `$out` aggregations Resolved an issue where the driver failed to detect MongoDB 5.0+ capabilities due to incorrect `commonWireVersion` initialization. As a result, aggregations with write stages now correctly respect `secondary` and `secondaryPreferred` read preferences, rather than forcing execution on the primary. Huge thanks to @crehbichler for discovering and investigating this bug and for [implementing a fix](https://github.com/mongodb/node-mongodb-native/pull/4805)! ###### ⚠️ Deprecations ###### `RenameCollectionOptions.new_collection` This option has been unused since driver 4.x. It is now deprecated and will be removed in a future major release. Existing code that sets this option can safely remove it with no behavioral change. ###### Features * **NODE-5393:** aws4 no longer required for AWS authentication ([#4824](https://github. _[Truncated at 4000 characters — full notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0]_ ### v7.0.0 - Date: 2025-11-06 - Version: v7.0.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v7.0.0 - **changed** — Minimum supported Node.js version is now v20.19.0 - **changed** — TypeScript target has been updated to ES2023 - **added** — Native support for explicit resource management with Symbol.asyncDispose implementations on MongoClient, ClientSession, ChangeStream and cursors - **changed** — Driver updated to use bson@7.0.0 and mongodb-connection-string-url@7.0.0 - **changed** — Minimum version for @mongodb-js/zstd optional peer dependency raised to 7.0.0, dropped support for 1.x and 2.x - **changed** — Minimum version for kerberos optional peer dependency raised to 7.0.0, dropped support for 2.x - **changed** — Minimum version for mongodb-client-encryption optional peer dependency raised to 7.0.0, dropped support for 6.x - **changed** — Updated compatibility for @aws-sdk/credential-providers to ^3.806.0, gcp-metadata to ^7.0.1, and socks to ^2.8.6 - **changed** — @aws-sdk/credential-providers is now required for MONGODB-AWS authentication - **changed** — Custom AWS credential provider via AWS_CREDENTIAL_PROVIDER takes highest precedence over other AWS auth methods - **removed** — Explicitly provided credentials no longer accepted with MONGODB-AWS authentication in connection strings - **changed** — Dropping a collection returns false instead of throwing when namespace not found - **changed** — Aggregate with write concern and explain now throws MongoServerError instead of client-side error - **fixed** — All encryption-related errors now subclass MongoError - **fixed** — Fixed typo in error label from PoolRequstedRetry to PoolRequestedRetry ##### [7.0.0](https://github.com/mongodb/node-mongodb-native/compare/v6.20.0...v7.0.0) (2025-11-06) The MongoDB Node.js team is pleased to announce version 7.0.0 of the `mongodb` package! ##### Release Notes The following is a detailed collection of the changes in the major v7 release of the `mongodb` package for Node.js. The main focus of this release was usability improvements and a streamlined API. Read on for details! > [!IMPORTANT] > This is a list of changes relative to v6.21.0 of the driver. ALL changes listed below are BREAKING unless indicated otherwise. > Users migrating from an older version of the driver are advised to upgrade to at least v6.21.0 before adopting v7. ##### 🛠️ Runtime and dependency updates ###### Minimum Node.js version is now v20.19.0 The minimum supported Node.js version is now [v20.19.0](https://nodejs.org/en/blog/release/v20.19.0) and our TypeScript target has been updated to ES2023. We strive to keep our minimum supported Node.js version in sync with the runtime's [release cadence](https://nodejs.dev/en/about/releases/) to keep up with the latest security updates and modern language features. Notably, the driver now offers native support for explicit resource management. `Symbol.asyncDispose` implementations are available on the `MongoClient`, `ClientSession`, `ChangeStream` and on cursors. > [!Note] > Explicit resource management is considered experimental in the driver and will be until the [TC39 explicit resource management proposal](https://github.com/tc39/proposal-explicit-resource-management) is completed. ###### `bson` and `mongodb-connection-string-url` versions 7.0.0 This driver version has been updated to use `bson@7.0.0` and `mongodb-connection-string-url@7.0.0`, which match the driver's Node.js runtime version support. BSON functionality re-exported from the driver is furthermore subject to the changes outlined in the [BSON V7 release notes](https://github.com/mongodb/js-bson/releases/tag/v7.0.0). ###### Optional peer dependency releases and version bumps - `@mongodb-js/zstd` optional peer dependency minimum version raised to `7.0.0`, dropped support for `1.x` and `2.x` (note that `@mongodb-js/zstd` does not have `3.x-6.x` version releases) - `kerberos` optional peer dependency minimum version raised to `7.0.0`, dropped support for `2.x` (note that `kerberos` does not have `3.x-6.x` version releases) - `mongodb-client-encryption` optional peer dependency minimum version raised to `7.0.0`, dropped support for `6.x` Additionally, the driver is now compatible with the following packages: | Dependency | Previous Range | New Allowed Range | | ----------------------------- | -------------- | ----------------- | | @aws-sdk/credential-providers | ^3.188.0 | ^3.806.0 | | gcp-metadata | ^5.2.0 | ^7.0.1 | | socks | ^2.7.1 | ^2.8.6 | ##### 🔐 AWS authentication To improve long-term maintainability and ensure compatibility with AWS updates, we’ve standardized AWS auth to use the official SDK in all cases and made a number of supporting changes outlined below. ###### `@aws-sdk/credential-providers` is now required for MONGODB-AWS authentication Previous versions of the driver contained two implementations for AWS authentication and could run the risk of the custom driver implementation not supporting all AWS authentication features as well as not being correct when AWS makes changes. Using the official AWS SDK in all cases alleviates these issues. ```bash npm install @aws-sdk/credential-providers ``` ###### Custom AWS credential provider takes highest precedence When providing a custom AWS credential provider via the auth mechanism property `AWS_CREDENTIAL_PROVIDER`, it will now take the highest precedence over any other AWS auth method. ###### Explicitly provided credentials no longer accepted with MONGODB-AWS authentication AWS environments (such as AWS Lambd _[Truncated at 4000 characters — full notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0]_ ### v6.21.0 - Date: 2025-11-05 - Version: v6.21.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v6.21.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v6.21.0 - **deprecated** — MongoCredentials.authMechanismProperties.AWS_SESSION_TOKEN will be removed in v7.0.0 - **deprecated** — CommandOptions.noResponse will be removed in v7.0.0 - **deprecated** — ConnectionOptions.cancellationToken will be removed in v7.0.0 - **deprecated** — CursorStreamOptions will be removed in v7.0.0 ##### [6.21.0](https://github.com/mongodb/node-mongodb-native/compare/v6.20.0...v6.21.0) (2025-11-05) The MongoDB Node.js team is pleased to announce version 6.21.0 of the `mongodb` package! ##### Release Notes ###### Deprecated items to be removed in 7.0.0 The following items have been deprecated and will be removed in 7.0.0: ```ts MongoCredentials.authMechanismProperties.AWS_SESSION_TOKEN // URI & client options for AWS variables will no longer be respected CommandOptions.noResponse // Unused ConnectionOptions.cancellationToken // Unused CursorStreamOptions // Only option, transform, removed in favor of Stream#map ``` ###### Features * **NODE-7230:** add deprecations of items to be removed in v7 ([#4774](https://github.com/mongodb/node-mongodb-native/issues/4774)) ([5104c0f](https://github.com/mongodb/node-mongodb-native/commit/5104c0fc9a931d778e9741cce8bdbf7f998499fa)) ##### Documentation * [Reference](https://docs.mongodb.com/drivers/node/current/) * [API](https://mongodb.github.io/node-mongodb-native/6.21/) * [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v6.21.0/HISTORY.md) We invite you to try the `mongodb` library immediately, and report any issues to the [NODE project](https://jira.mongodb.org/projects/NODE). ### v6.20.0 - Date: 2025-09-18 - Version: v6.20.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v6.20.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v6.20.0 - **added** — Collection and Db objects now provide references to their associated Db and MongoClient through db and client properties - **changed** — Hint is now supported with unacknowledged writes for delete, update and findAndModify commands on servers that support hint - **deprecated** — ServerCapabilities class is deprecated - **deprecated** — ReadPreference.minWireVersion property is deprecated - **deprecated** — MongoClient driverInfo option is deprecated - **deprecated** — MongoClient additionalDriverInfo option is deprecated - **deprecated** — MongoClient metadata option is deprecated - **deprecated** — MongoClient extendedMetadata option is deprecated - **deprecated** — CommandOperationOptions.retryWrites option is deprecated - **fixed** — ChangeStream .tryNext() now updates resumeToken to prevent duplicate change documents after resume - **fixed** — Change Streams now resume on MongoServerSelectionError instead of throwing the error - **changed** — MongoClient.appendMetadata() now ignores duplicate metadata instead of appending it ##### [6.20.0](https://github.com/mongodb/node-mongodb-native/compare/v6.19.0...v6.20.0) (2025-09-17) The MongoDB Node.js team is pleased to announce version 6.20.0 of the `mongodb` package! ##### Release Notes ###### `Collection` and `Db` objects now provide references to their `Db` and `MongoClient` ```ts import { MongoClient } from 'mongodb'; const client = new MongoClient(process.env.MONGODB_URI); const db = client.db('test'); assert(db.client === client); // returns the MongoClient associated with the Db object const collection = db.collection('test'); assert(collection.db === db); // returns the Db associated with the Collection object ``` ###### Hint is supported with unacknowledged writes for delete, update and findAndModify commands on servers that support hint The driver no longer throws errors when `hint` is provided to unacknowledged writes for `delete`, `update` and `findAndModify` commands in the following circumstances: - No error is thrown for `update` commands. - No errors are thrown for `delete` and `findAndModify` commands on servers >=4.4. ###### ServerCapabilities and ReadPreference.minWireVersion are deprecated Neither the `ServerCapabilities` class nor the `ReadPreference.minWireVersion` property were ever intended for public use and, internally, are effectively dead code with the driver's minimum supported server version being 4.2. ###### Driver info and metadata MongoClient options have been deprecated. These will be made internal in a future major release: - `driverInfo` - `additionalDriverInfo` - `metadata` - `extendedMetadata` ###### `CommandOperationOptions.retryWrites` is deprecated `CommandOperationOptions.retryWrites` is deprecated. This per‑command option has no effect; the Node.js driver only honors `retryWrites` when configured at the client level (MongoClient options) or via the connection string. Do not use this option on individual commands. There is no runtime behavior change because it was already ignored, but it will be removed in an upcoming major release and may cause type or build errors in code that references it. To control retryable writes, set `retryWrites` in MongoClient options or include `retryWrites=true|false` in the connection string. ###### ChangeStream `.tryNext()` now updates `resumeToken` to prevent duplicates after resume When `.tryNext()` returns a change document, the driver now caches its `resumeToken`, aligning its behavior with `.next()` and the `'change'` event. If `.tryNext()` returns `null` (no new changes), nothing is cached, which is unchanged from previous behavior. Previously, `.tryNext()` did not update the `resumeToken`, so a resumable error could cause a resume from an older token and re-deliver already processed changes. With this release, resumes continue from the latest token observed via `.tryNext()`, preventing duplicates. ```javascript const changeStream = collection.watch([]); while (true) { const change = await changeStream.tryNext(); // prior versions could return duplicates await scheduler.wait(1000); // delay since tryNext() does not wait for changes } ``` Applications that poll change streams with `.tryNext()` in non-blocking loops benefit directly. There are no API changes; if you previously tracked and passed `resumeAfter` or `startAfter` manually, you can now rely on the driver’s built-in token caching. Huge thanks to @rkistner for bringing this bug to our attention and for [sharing code](https://gist.github.com/rkistner/fef2013ca9eb86aee883fc80b8267382) to reproduce it. Huge thanks as well to @Omnicpie for investigating and implementing a fix. ###### Change Streams now resume on `MongoServerSelectionError` When the driver encounters a `MongoServerSelectionError` while processing a Change Stream (e.g., due to a transient network issue or during an election), it now treats the error as resumable and attempts to resume using the latest cached resume token. _[Truncated at 4000 characters — full notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v6.20.0]_ ### v6.19.0 - Date: 2025-08-26 - Version: v6.19.0 - Original notes: https://github.com/mongodb/node-mongodb-native/releases/tag/v6.19.0 - Permalink: https://whatsnew.fyi/product/mongodb-node-driver/releases/v6.19.0 - **added** — Support queryable encryption text field prefix, suffix and substring queries - **added** — Allow secureContext option in KMS TLS options for auto encryption and client encryption - **changed** — findOne command now always sets limit to 1 and singleBatch to true - **changed** — find command sets limit to batchSize + 1 when both options are equal to avoid leaving cursors open - **deprecated** — limit, noCursorResponse and batchSize options in findOne and find commands - **changed** — MongoClient no longer sends ping command on connect when authentication is enabled, instead checks out a connection from the pool to force initial handshake ##### [6.19.0](https://github.com/mongodb/node-mongodb-native/compare/v6.18.0...v6.19.0) (2025-08-26) The MongoDB Node.js team is pleased to announce version 6.19.0 of the `mongodb` package! ##### Release Notes ###### Experimental Support for Queryable Encryption Text Field Prefix, Suffix and Substring Queries > [!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`. ###### Allow a `secureContext` for Auto Encryption and Client Encryption TLS options This can be provided in the `tlsOptions` option both both objects. ```ts 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 server The `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. ###### Clients no longer send a ping on connect 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. ###### Features * **NODE-4179:** allow secureContext in KMS TLS options ([#4578](https://github.com/mongodb/node-mongodb-native/issues/4578)) ([0ea6eaa](https://github.com/mongodb/node-mongodb-native/commit/0ea6eaa82d56073f1a63d4168935d63a4a4e7a61)) * **NODE-6472:** findOne and find no longer keep open cursors ([#4580](https://github.com/mongodb/node-mongodb-native/issues/4580)) ([be7f808](https://github.com/mongodb/node-mongodb-native/commit/be7f808c3ff0d894906ec187de98e159ebb7b18d)) * **NODE-7020:** remove ping on connect ([#4607](https://github.com/mongodb/node-mongodb-native/issues/4607)) ([3d296b7](https://github.com/mongodb/node-mongodb-native/commit/3d296b7d94810c3bc29153ffc3c8795f02699dd4)) * **NODE-7059, NODE-7008:** add support for text queries for QE string fields ([#4597](https://github.com/mongodb/node-mongodb-native/issues/4597)) ([e4492f3](https://github.com/mongodb/node-mongodb-native/commit/e4492f3ff260a440ab4b2cb64ca90a68f9cf6fd5)) ##### Documentation * [Reference](https://docs.mongodb.com/drivers/node/current/) * [API](https://mongodb.github.io/node-mongodb-native/6.19/) * [Changelog](https://github.com/mongodb/node-mongodb-native/blob/v6.19.0/HISTORY.md) We invite you to try the `mongodb` library immediately, and report any issues to the [NODE project](https://jira.mongodb.org/projects/NODE).