-
Notifications
You must be signed in to change notification settings - Fork 0
Requirements
- For a long-term app, migrate the stack to the current 7.x Node.js driver line instead of freezing on 6.x. The current public docs are for Node.js Driver v7.x, while QE text preview support already exists in late 6.x starting at
mongodb6.19.0 plusmongodb-client-encryption6.5.0. - Keep
node:22-slim. Node.js driver 6.11 to 6.20 explicitly supports Node.js 22, and v7 removes only Node 16 and Node 18, which fits your current runtime direction. - Treat QE substring, prefix, and suffix as preview-only features. The server docs say they are public preview, should not be enabled in production, and the future GA behavior will be incompatible with the preview behavior.
- Your current package pair,
mongodb ^6.5.0andmongodb-client-encryption ^6.0.1, is not sufficient for QE substring, prefix, and suffix support in Node.js. - The minimum late-6.x baseline for those QE text features is
mongodb >= 6.19.0andmongodb-client-encryption >= 6.5.0. - Atlas 8.3.5 is a suitable server side target for the app because the current 8.3 QE docs still document substring, prefix, and suffix as supported preview capabilities introduced in 8.2.
| Feature | Minimum on 6.x line | Minimum on 7.x line | Server floor |
|---|---|---|---|
| Queryable Encryption base compatibility |
mongodb >= 6.0.0 with mongodb-client-encryption >= 6.0.0 on matching major versions |
mongodb >= 7.0.0 with mongodb-client-encryption >= 7.0.0 because v7 updates the peer dependency to mongodb-client-encryption@7.0.0
|
QE feature family depends on the server capability you use |
| QE range queries |
mongodb >= 6.10.0 and mongodb-client-encryption >= 6.1.0
|
mongodb >= 7.0.0 and mongodb-client-encryption >= 7.0.0 as the minimum supported pair on the 7.x line. The range feature already existed before v7, so no higher 7.x floor is documented for it |
MongoDB Server >= 8.0 |
| QE substring, prefix, suffix preview |
mongodb >= 6.19.0 and mongodb-client-encryption >= 6.5.0
|
mongodb >= 7.0.0 and mongodb-client-encryption >= 7.0.0 as the minimum supported pair on the 7.x line. These text features were already introduced in 6.19, so the 7.x floor is the branch floor, not a newer feature floor |
Preview capability documented for MongoDB Server >= 8.2
|
- If you need the absolute minimum viable v6 stack for your app, use
mongodb 6.19.x+andmongodb-client-encryption 6.5.x+to cover both QE range and QE substring, prefix, suffix preview on Atlas 8.3.5. - If you migrate to v7, the safest minimum branch floor is
mongodb 7.0.0+withmongodb-client-encryption 7.0.0+, but for operational reasons it is still better to pin to a recent tested 7.x pair rather than the first 7.0 build. - Range is production supported, while substring, prefix, and suffix remain preview in the server documentation for the 8.2 and 8.3 era behavior used by this app.
Use this package floor as the v6 fallback target:
{
"dependencies": {
"mongodb": "^6.19.0",
"mongodb-client-encryption": "^6.5.0"
}
}This fallback preserves all QE features relevant to your app:
- equality
- range
- substring, prefix, suffix preview
- Runtime:
node:22-slim. - Atlas:
8.3.5. - Driver line:
mongodb7.x, current public line. - Encryption package line:
mongodb-client-encryption7.x, same major as the driver. - Version pinning rule: validate and pin a tested 7.x pair together. As current references, the public upgrade docs use
mongodb@7.4, and the current repository metadata shows driver7.5.0with peer dependencymongodb-client-encryption ^7.2.0on the active branch.
{
"engines": {
"node": ">=22"
},
"dependencies": {
"mongodb": "^7.4.0",
"mongodb-client-encryption": "^7.2.0"
}
}- v7 is the current documentation and upgrade path, so it is the better baseline for an app that you plan to keep refreshed over time.
- MongoDB does not publish a public per-driver LTS or EOL schedule for driver branches. Internal driver policy discussion explicitly states that there is no public support and EOL policy document for drivers.
- The same internal discussion describes an internal policy target of supporting at most two major versions at a time, with bug fixes and patches backported from the current major to the previous major for one year after a new major release, and no feature backports.
- In practice, that means v7 is the closest thing to the stable current line, while v6 is mature but should be treated as a transitional branch for this app, not the destination state.
Upgrade the app from the current 6.x dependency set to a 7.x dependency set while preserving QE support and enabling substring, prefix, and suffix app flows.
- Do not redesign the QE app flow unless required by driver breakage.
- Do not present substring, prefix, or suffix as production-ready features.
- Change
mongodbfrom 6.x to 7.x. - Change
mongodb-client-encryptionfrom 6.x to 7.x in the same change set. The v7 upgrade guide explicitly moves the peer dependency tomongodb-client-encryption@7.0.0. - Keep driver and encryption package on the same major. The v6 guide already enforced matching major versions, and v7 continues that alignment pattern through the peer dependency matrix.
- QE substring, prefix, and suffix support in Node.js first arrived in driver v6.19 and requires
mongodb-client-encryption6.5 or later. Upgrading to 7.x is about long-term maintainability, not about unlocking a newer minimum for the feature itself. - The server side feature is still documented as preview in current QE docs, so plan for future adjustments when GA lands.
- In Node.js driver v6 and later,
ClientEncryptionshould be imported frommongodb, not frommongodb-client-encryption.
import { MongoClient, ClientEncryption } from "mongodb";- Remove
useNewUrlParserif it is still present. - Remove
useUnifiedTopologyif it is still present. - Remove any leftover deprecated SSL-prefixed configuration if it survived prior migrations, and prefer TLS-prefixed options or
secureContextpatterns already required by modern driver behavior.
const client = new MongoClient(uri, {
autoEncryption: autoEncryptionOptions
});- If the app uses
MONGODB-AWS, v7 now requires@aws-sdk/credential-providersand no longer supports the old URI-encoded AWS credential style in the connection string. - If your app does not use AWS auth, this item is irrelevant and can be skipped.
- v7 removes the old default cursor
batchSizeof 1000. If any app path depends on that behavior for memory, latency, or output pacing, set it explicitly.
const cursor = collection.find(query).batchSize(100);- v7 removes support for transform functions passed into cursor and change stream streams. Replace
stream({ transform: fn })withstream().map(fn).
const stream = cursor.stream().map(JSON.stringify);- v7 updates peer dependency ranges for
@mongodb-js/zstd,kerberos, and related packages. - If your app does not use compression, Kerberos, or AWS auth, you can avoid adding extra packages beyond
mongodb-client-encryption. - If you do use Zstandard compression, update that package to a 7.x-compatible line as part of the same change set.
- v7 normalizes encryption errors so they subclass
MongoError, and one crypto connection error path changes toMongoRuntimeErrorinstead ofMissingDependencyError. - If your app prints or pattern-matches error names, update those checks to target the stable error hierarchy rather than old string comparisons.
- Your
node:22-slimbase image is a reasonable long-term choice for this app direction because your runtime is already on a modern supported line, and the v7 branch is explicitly dropping only Node 16 and 18. - After changing package majors, force a clean reinstall so the native encryption bindings are rebuilt against the new dependency graph.
FROM node:22-slim
WORKDIR /app
COPY package*.json ./
RUN npm ci
COPY . .
CMD ["node", "index.js"]Run a targeted search over the repo for the following patterns and patch each result deliberately:
-
mongodb-client-encryptionimport sites forClientEncryption. -
useNewUrlParser. -
useUnifiedTopology. -
stream({ transform:or equivalent cursor transform usage. -
authMechanism=MONGODB-AWSif applicable. - Any explicit dependency pins to
mongodb6.x ormongodb-client-encryption6.x. - Any error handling that assumes old encryption error classes or names.
"dependencies": {
- "mongodb": "^6.5.0",
- "mongodb-client-encryption": "^6.0.1"
+ "mongodb": "^7.4.0",
+ "mongodb-client-encryption": "^7.2.0"
}- The app starts successfully in
node:22-slimand connects to Atlas 8.3.5. - Automatic encryption initializes successfully with the 7.x dependency pair.
- A QE-enabled collection can be created or reused with your existing key management flow.
- Equality and range flows still work after the package upgrade.
- Prefix query returns expected matches on encrypted data.
- Suffix query returns expected matches on encrypted data.
- Substring query returns expected matches on encrypted data.
- App copy and comments clearly label these text features as preview and not production-ready.
Migrate now to a validated 7.x pair and keep the rest of the app architecture stable. For your use case, v7 is the better long-term foundation, while the QE text capability requirement itself is already satisfied by late 6.x and therefore should not be the only reason to upgrade. The real reasons to upgrade are lifecycle alignment, current-doc alignment, and lower maintenance cost for a app you intend to keep current over time.
- MongoDB Node.js Driver - Node.js Driver - MongoDB Docs
- Release Notes - Node.js Driver - MongoDB Docs
- Compatibility - Node.js Driver - MongoDB Docs
- Upgrade Driver Versions - Node.js Driver - MongoDB Docs
- Queryable Encryption - Database Manual - MongoDB Docs
- package.json
- Memo: Supportability and EOL Policy for Drivers
- Queryable Encryption Quick Start - Database Manual - MongoDB Docs
- Network Compression - Node.js Driver - MongoDB Docs