# MongoDB Node.js Driver v6.20.0 - Product: MongoDB Node.js Driver (https://whatsnew.fyi/product/mongodb-node-driver) - Vendor: MongoDB - 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 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'. --- - **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]_