# What changed in mongodb

> 92 changes in mongodb 6 to 7 from its official release notes, upgrade guides and advisories: 52 breaking, 7 deprecations, 7 new APIs and options. Each one cited. Sources checked 2026-10-17. HTML: https://unstale.sh/npm/mongodb/

To see which of these apply to a repository, run `npx @unstale/cli init` in it.

## mongodb 7

### Breaking changes

- The driver no longer supports MongoDB 4.2 or older servers and throws an error when connecting to them. (7.6.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.6.0)
- Closing a client now closes checked-out connections across all servers, interrupting in-flight operations promptly. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- String replaces the TextPreview algorithm for Queryable Encryption string queries. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- StringOpts replaces TextOpts for Queryable Encryption string queries. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- On replica sets, server deprioritization is restricted to overload errors. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- Wildcard matching now requires full subdomain or path matches, preventing partial suffix matches from being accepted. (7.1.1) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.1)
- Aggregate with write concern and explain now throws a MongoServerError instead of throwing client-side. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- TypeScript now restricts the filename to the default crypt_shared library name or a path ending in that filename. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- TypeScript now restricts the filename to the default mongocryptd name or a path ending in that filename. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This package is now required for MONGODB-AWS authentication. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The beta namespace was removed; resource management moved into the driver. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated CancellationToken type has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated ClientMetadataOptions type has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated transaction property has been removed from ClientSession. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated CloseOptions type has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- retryWrites has been removed from CommandOperationOptions; it is a global MongoClient option. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The noResponse option has been removed; it was never intended for public APIs and did not work properly. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated autoIndexId option has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- Dropping a collection returns false instead of throwing when the namespace is not found. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated batchSize option has been removed from FindOneOptions. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated limit option has been removed from FindOneOptions. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated noCursorTimeout option has been removed from FindOneOptions. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- FindOptions no longer accepts a generic type parameter. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- Cursors no longer set a default batchSize of 1000 for getMore; it is set only when explicitly configured for the cursor. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated aliases option has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated contentType option has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated aliases property has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated contentType property has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The optional peer dependency minimum version is 7.0.0; support for version 2.x is dropped. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- connect now runs a handshake regardless of whether credentials are defined, making fail-fast precondition checks more consistent across environments. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated useNewUrlParser option has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated useUnifiedTopology option has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The driver now uses bson@7.0.0; BSON functionality re-exported from the driver is subject to the BSON V7 release-note changes. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- Explicit credentials in the URI or options are no longer accepted; AWS credentials are fetched through the required AWS SDK. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The optional peer dependency minimum version is raised to 7.0.0, dropping support for 6.x. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The unsupported MONGODB-CR authentication mechanism has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The optional peer dependency minimum version is 7.0.0; support for versions 1.x and 2.x is dropped. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- This internal ClientMetadata property is no longer exposed in the public API. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated minWireVersion property has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated ResumeOptions type has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated ServerCapabilities type has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- Cursor and ChangeStream stream() no longer accepts a transform function; ReadableStream.map() can be used instead. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- MongoClient, ClientSession, ChangeStream, and cursors implement Symbol.asyncDispose for explicit resource management; this support is experimental. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The deprecated Transaction type has been removed. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)

### Deprecations

- The prefixPreview query type is deprecated and will be removed in a future release. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- The substringPreview query type is deprecated and will be removed in a future release. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- The suffixPreview query type is deprecated and will be removed in a future release. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- The unused new_collection option is deprecated and can be safely removed with no behavioral change. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)

### New APIs and options

- Support was added for baseBackoffMS alongside an update to client backpressure backoff. (7.6.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.6.0)
- Set this callback on ClientEncryption or auto-encryption options to connect to KMS hosts through an HTTP proxy; the driver performs the KMS TLS handshake over the returned socket. (7.6.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.6.0)
- Returns the number of documents remaining in the change stream from the last batch, allowing callers to check for buffered documents before invoking async methods. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- The token bucket is optional in client backpressure. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- When enabled, the driver deprioritizes servers that return overload errors during retry server selection; defaults to false. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- Configures the maximum number of retries during server overload; defaults to 2, and 0 disables overload retries. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- Experimental MongoClient option for injecting core Node.js APIs, including the os module, for alternative runtimes or restricted environments. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)

### Performance

- insertMany and bulkWrite serialize each document once and reuse the resulting bytes for batch sizing and commands, reducing BSON-encoding CPU and event-loop blocking. (7.6.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.6.0)

### Behavior and default changes

- The driver retries overload errors only when a retry is expected not to worsen server conditions, improving performance for MongoDB 9.0's Intelligent Workload Management. (7.6.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.6.0)
- The prefix query type is now generally available for Queryable Encryption string queries. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- The substring query type is now generally available for Queryable Encryption string queries. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- The suffix query type is now generally available for Queryable Encryption string queries. (7.5.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.5.0)
- The async disposal methods on MongoClient, ClientSession, ChangeStream, and cursors are now officially supported, enabling await using for automatic cleanup without experimental flags. (7.4.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.4.0)
- The maximum wire version and maximum server version were bumped to 29 in preparation for MongoDB LTS (v9.0). (7.3.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.3.0)
- Retry loops use exponential backoff and jitter. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- The driver uses standard Uint8Array APIs and globalThis.crypto instead of Node-specific Buffer and crypto APIs, improving compatibility with non-Node.js runtimes. (7.2.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.2.0)
- The default OIDC allowed-host list now supports hosts matching *.mongo.com. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)
- The driver replaces Node-specific APIs with standards-based equivalents and explicitly imports node:process, improving compatibility with alternate runtimes. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)
- Connection establishment failures no longer clear the pool, preventing unnecessary connection churn when server-side connection rate limiting rejects requests. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)
- When retrying a command, server selection deprioritizes servers to improve stability and reduce repeated targeting of overloaded or previously failed servers. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)
- A custom AWS credential provider now takes the highest precedence over other AWS authentication methods. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- Change streams no longer filter $changeStream stage options, allowing options to reach the server even before they are in public type definitions. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- close only attempts session cleanup when the topology supports sessions. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- Errors thrown during encryption are now subclasses of MongoError. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)

### Fixes and other changes

- A failed OIDC token fetch now affects only the operation that triggered it; later operations can attempt a new token fetch without restarting the process. (7.7.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.7.0)
- The default os adapter now loads through dynamic import, so constructing a MongoClient in bundled ESM output no longer throws `ReferenceError: require is not defined`. (7.6.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.6.0)
- Write operations in causally consistent sessions now include readConcern.afterClusterTime, maintaining the “read your own writes” guarantee across primary failovers in sharded clusters. (7.4.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.4.0)
- Explicit UTF-8 string conversion fixes SCRAM authentication in non-Node.js environments such as Deno and other web-compatible runtimes. (7.3.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.3.0)
- The driver now applies TCP keep-alive and no-delay settings after TLS socket creation, preventing settings from being silently ignored. (7.1.1) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.1)
- OIDC reauthentication now succeeds when MongoClient is configured with promoteValues: false. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)
- Aggregations using $merge or $out now respect secondary and secondaryPreferred read preferences instead of forcing execution on the primary. (7.1.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.1.0)
- The options parameter is now correctly marked optional in the TypeScript definition. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)
- The PoolClearedError error label typo is fixed from PoolRequstedRetry to PoolRequestedRetry. (7.0.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v7.0.0)

## mongodb 6

### Breaking changes

- The transform option is deprecated and removed in favor of Stream#map; CursorStreamOptions will be removed in 7.0.0. (6.21.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v6.21.0)

### Deprecations

- noResponse is deprecated as unused and will be removed in 7.0.0. (6.21.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v6.21.0)
- cancellationToken is deprecated as unused and will be removed in 7.0.0. (6.21.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v6.21.0)
- AWS_SESSION_TOKEN is deprecated and will be removed in 7.0.0; URI and client options for AWS variables will no longer be respected. (6.21.0) — [release notes](https://github.com/mongodb/node-mongodb-native/releases/tag/v6.21.0)
