MongoDB Node.js Driver v7.6.0

v7.6.0
Added 1
  • Add HTTP proxy support for KMS requests in CSFLE and Queryable Encryption via kmsConnectCallback option on ClientEncryption and auto-encryption options
Changed 4
  • Bump minimum server version from 4.2 to 4.4 and minimum wire version from 8 to 9
  • Improve performance for MongoDB 9.0's Intelligent Workload Management by only retrying overload errors when expected to not worsen server conditions
  • Support baseBackoffMS and update client backpressure backoff
  • Serialize bulk write documents a single time to reduce BSON-encoding CPU usage and event-loop blocking during large batches
Fixed 1
  • Fix ReferenceError when bundling the driver into ESM by using dynamic import() for the os module instead of static require()

From MongoDB Node.js Driver

7.6.0 (2026-08-21)

The MongoDB Node.js team is pleased to announce version 7.6.0 of the mongodb package!

Release Notes
HTTP proxy support for KMS requests in CSFLE and Queryable Encryption

In-use encryption can now route KMS requests through an HTTP proxy. Set kmsConnectCallback on your ClientEncryption or auto-encryption options to control how the driver connects to a KMS host. The callback receives the target host and port and returns a connected socket (for example, a tunnel opened with HTTP CONNECT); the driver then performs the KMS TLS handshake over that socket using the provider's configured TLS options. This unblocks CSFLE and Queryable Encryption in environments that require an HTTP forward proxy for outbound KMS traffic, which the existing SOCKS5 proxyOptions does not cover.

const clientEncryption = new ClientEncryption(keyVaultClient, {
  keyVaultNamespace,
  kmsProviders,
  // Establish the KMS connection through your HTTP proxy; the driver adds TLS.
  kmsConnectCallback: ({ host, port }) => connectThroughHttpProxy(host, port)
});
Bumped minimum server version (4.2 -> 4.4) & minimum wire version (8 -> 9)
  • This change finalizes dropping support for mongo server v4.2, which has been marked EOL. To continue using the driver, use mongo server v4.4 at minimum.
Improved Intelligent Workload Management

Improved performance for MongoDB 9.0's Intelligent Workload Management (IWM) by only retrying overload errors when doing so is expected to not worsen server conditions

Bundling the driver into ESM no longer throws ReferenceError: require is not defined

v7.2.0 introduced the experimental runtimeAdapters option and, as part of it, replaced the driver’s static import of Node’s os module with a runtime require('os'). That works in a CommonJS build, but when the driver is bundled into ESM output (e.g. a Vite/esbuild/rollup server build with "type": "module"), there is no require in module scope, so constructing a client threw ReferenceError: require is not defined. The driver now loads the default os adapter through a dynamic import() that survives bundling, so new MongoClient() works in ESM bundles. CommonJS usage is unchanged, and supplying your own runtimeAdapters.os continues to work.

Bulk writes serialize each document only once

insertMany and bulkWrite previously processed each document twice - once to measure its size for batch splitting (a full recursive walk via calculateObjectSize) and again to serialize it into the command sent to the server. Documents are now serialized a single time and the resulting bytes are reused for both, decreasing the BSON-encoding CPU spent on bulk writes and reducing event-loop blocking during large batches. The improvement is most noticeable with high document counts and documents that have many fields.

Features
  • NODE-7546: add HTTP Proxy support for QE & CSFLE (#5007) (3366c21)
  • NODE-7547: bump minimum support server/wire versions to '4.4' & '9' respectively (#4994) (3d97028)
  • NODE-7624: support baseBackoffMS and update client backpressure backoff (#5020) (560837b)
Bug Fixes
  • NODE-7603: emit dynamic import('os') via tsconfig (#4992) (52f5e61)
Performance Improvements
  • NODE-7660: serialize bulk write documents a single time (#4999) (1217aa1)
Documentation

We invite you to try the mongodb library immediately, and report any issues to the NODE project.

View original

Upgraded? How did it go?

Discussion