npm / mongodb
mongodb
What changed in mongodb 6 to 7, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-17.
52 breaking7 deprecations7 new APIs and options1 performance16 behavior and defaults9 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initmongodb 788 changes
Breaking changes 51
The driver no longer supports MongoDB 4.2 or older servers and throws an error when connecting to them.
Closing a client now closes checked-out connections across all servers, interrupting in-flight operations promptly.
String replaces the TextPreview algorithm for Queryable Encryption string queries.
StringOpts replaces TextOpts for Queryable Encryption string queries.
On replica sets, server deprioritization is restricted to overload errors.
Wildcard matching now requires full subdomain or path matches, preventing partial suffix matches from being accepted.
Aggregate with write concern and explain now throws a MongoServerError instead of throwing client-side.
TypeScript now restricts the filename to the default crypt_shared library name or a path ending in that filename.
TypeScript now restricts the filename to the default mongocryptd name or a path ending in that filename.
This package is now required for MONGODB-AWS authentication.
The beta namespace was removed; resource management moved into the driver.
The deprecated CancellationToken type has been removed.
The deprecated ClientMetadataOptions type has been removed.
The deprecated transaction property has been removed from ClientSession.
The deprecated CloseOptions type has been removed.
retryWrites has been removed from CommandOperationOptions; it is a global MongoClient option.
The noResponse option has been removed; it was never intended for public APIs and did not work properly.
This internal ClientMetadata property is no longer exposed in the public API.
This internal ClientMetadata property is no longer exposed in the public API.
The deprecated autoIndexId option has been removed.
Dropping a collection returns false instead of throwing when the namespace is not found.
The deprecated batchSize option has been removed from FindOneOptions.
The deprecated limit option has been removed from FindOneOptions.
The deprecated noCursorTimeout option has been removed from FindOneOptions.
FindOptions no longer accepts a generic type parameter.
Cursors no longer set a default batchSize of 1000 for getMore; it is set only when explicitly configured for the cursor.
The deprecated aliases option has been removed.
The deprecated contentType option has been removed.
The deprecated aliases property has been removed.
The deprecated contentType property has been removed.
The optional peer dependency minimum version is 7.0.0; support for version 2.x is dropped.
connect now runs a handshake regardless of whether credentials are defined, making fail-fast precondition checks more consistent across environments.
This internal ClientMetadata property is no longer exposed in the public API.
This internal ClientMetadata property is no longer exposed in the public API.
This internal ClientMetadata property is no longer exposed in the public API.
The deprecated useNewUrlParser option has been removed.
The deprecated useUnifiedTopology option has been removed.
The driver now uses bson@7.0.0; BSON functionality re-exported from the driver is subject to the BSON V7 release-note changes.
Explicit credentials in the URI or options are no longer accepted; AWS credentials are fetched through the required AWS SDK.
The optional peer dependency minimum version is raised to 7.0.0, dropping support for 6.x.
The unsupported MONGODB-CR authentication mechanism has been removed.
The optional peer dependency minimum version is 7.0.0; support for versions 1.x and 2.x is dropped.
This internal ClientMetadata property is no longer exposed in the public API.
This internal ClientMetadata property is no longer exposed in the public API.
This internal ClientMetadata property is no longer exposed in the public API.
The deprecated minWireVersion property has been removed.
The deprecated ResumeOptions type has been removed.
The deprecated ServerCapabilities type has been removed.
Cursor and ChangeStream stream() no longer accepts a transform function; ReadableStream.map() can be used instead.
MongoClient, ClientSession, ChangeStream, and cursors implement Symbol.asyncDispose for explicit resource management; this support is experimental.
The deprecated Transaction type has been removed.
Deprecations 4
The prefixPreview query type is deprecated and will be removed in a future release.
The substringPreview query type is deprecated and will be removed in a future release.
The suffixPreview query type is deprecated and will be removed in a future release.
The unused new_collection option is deprecated and can be safely removed with no behavioral change.
New APIs and options 7
Support was added for baseBackoffMS alongside an update to client backpressure backoff.
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.
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.
The token bucket is optional in client backpressure.
When enabled, the driver deprioritizes servers that return overload errors during retry server selection; defaults to false.
Configures the maximum number of retries during server overload; defaults to 2, and 0 disables overload retries.
Experimental MongoClient option for injecting core Node.js APIs, including the os module, for alternative runtimes or restricted environments.
Performance 1
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.
Behavior and default changes 16
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.
The prefix query type is now generally available for Queryable Encryption string queries.
The substring query type is now generally available for Queryable Encryption string queries.
The suffix query type is now generally available for Queryable Encryption string queries.
The async disposal methods on MongoClient, ClientSession, ChangeStream, and cursors are now officially supported, enabling await using for automatic cleanup without experimental flags.
The maximum wire version and maximum server version were bumped to 29 in preparation for MongoDB LTS (v9.0).
Retry loops use exponential backoff and jitter.
The driver uses standard Uint8Array APIs and globalThis.crypto instead of Node-specific Buffer and crypto APIs, improving compatibility with non-Node.js runtimes.
The default OIDC allowed-host list now supports hosts matching *.mongo.com.
The driver replaces Node-specific APIs with standards-based equivalents and explicitly imports node:process, improving compatibility with alternate runtimes.
Connection establishment failures no longer clear the pool, preventing unnecessary connection churn when server-side connection rate limiting rejects requests.
When retrying a command, server selection deprioritizes servers to improve stability and reduce repeated targeting of overloaded or previously failed servers.
A custom AWS credential provider now takes the highest precedence over other AWS authentication methods.
Change streams no longer filter $changeStream stage options, allowing options to reach the server even before they are in public type definitions.
close only attempts session cleanup when the topology supports sessions.
Errors thrown during encryption are now subclasses of MongoError.
Fixes and other changes 9
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.
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.Write operations in causally consistent sessions now include readConcern.afterClusterTime, maintaining the “read your own writes” guarantee across primary failovers in sharded clusters.
Explicit UTF-8 string conversion fixes SCRAM authentication in non-Node.js environments such as Deno and other web-compatible runtimes.
The driver now applies TCP keep-alive and no-delay settings after TLS socket creation, preventing settings from being silently ignored.
OIDC reauthentication now succeeds when MongoClient is configured with promoteValues: false.
Aggregations using $merge or $out now respect secondary and secondaryPreferred read preferences instead of forcing execution on the primary.
The options parameter is now correctly marked optional in the TypeScript definition.
The PoolClearedError error label typo is fixed from PoolRequstedRetry to PoolRequestedRetry.
mongodb 64 changes
Breaking changes 1
The transform option is deprecated and removed in favor of Stream#map; CursorStreamOptions will be removed in 7.0.0.
Deprecations 3
noResponse is deprecated as unused and will be removed in 7.0.0.
cancellationToken is deprecated as unused and will be removed in 7.0.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.