mongodb/node-mongodb-native · error · MongoCompatibilityError
${INVALID_QE_VERSION} The minimum server version required is
Error message
${INVALID_QE_VERSION} The minimum server version required is ${MIN_SUPPORTED_QE_SERVER_VERSION} What it means
Thrown when creating a collection with Queryable Encryption (encryptedFields) against a server whose wire protocol is older than MIN_SUPPORTED_QE_WIRE_VERSION (21, i.e. MongoDB 7.0). QE v2 requires server-side support for the encrypted auxiliary collections (esc/ecoc), so the driver refuses to even attempt the create.
Source
Thrown at src/operations/create_collection.ts:169
const timeoutContext = TimeoutContext.create({
session: options.session,
serverSelectionTimeoutMS: db.client.s.options.serverSelectionTimeoutMS,
waitQueueTimeoutMS: db.client.s.options.waitQueueTimeoutMS,
timeoutMS: options.timeoutMS
});
const encryptedFields: Document | undefined =
options.encryptedFields ??
db.client.s.options.autoEncryption?.encryptedFieldsMap?.[`${db.databaseName}.${name}`];
if (encryptedFields) {
class CreateSupportingFLEv2CollectionOperation extends CreateCollectionOperation {
override buildCommandDocument(connection: Connection, session?: ClientSession): Document {
if (
!connection.description.loadBalanced &&
maxWireVersion(connection) < MIN_SUPPORTED_QE_WIRE_VERSION
) {
throw new MongoCompatibilityError(
`${INVALID_QE_VERSION} The minimum server version required is ${MIN_SUPPORTED_QE_SERVER_VERSION}`
);
}
return super.buildCommandDocument(connection, session);
}
}
// Create auxilliary collections for queryable encryption support.
const escCollection = encryptedFields.escCollection ?? `enxcol_.${name}.esc`;
const ecocCollection = encryptedFields.ecocCollection ?? `enxcol_.${name}.ecoc`;
for (const collectionName of [escCollection, ecocCollection]) {
const createOp = new CreateSupportingFLEv2CollectionOperation(db, collectionName, {
clusteredIndex: {
key: { _id: 1 },
unique: true
},View on GitHub (pinned to dce7939f86)
Solutions
- Upgrade the MongoDB server to 7.0 or later (wire version 21+).
- If you cannot upgrade, remove the encryptedFields option and the autoEncryption.encryptedFieldsMap entry so the driver does not attempt QE creation.
- Verify with db.hello().maxWireVersion >= 21 before issuing createCollection when encryptedFields is in play.
Example fix
// before — server is 6.0
await db.createCollection('patients', { encryptedFields });
// after — upgrade server to 7.0+, then the same call works Defensive patterns
Strategy: validation
Validate before calling
const hello = await db.command('hello');
if (options.encryptedFields && hello.maxWireVersion < 21) {
throw new Error('Queryable Encryption requires MongoDB 7.0+ (wire version 21)');
}
await db.createCollection(name, options); Prevention
- Check db.hello().maxWireVersion before issuing createCollection with encryptedFields.
- Pin your server major version when relying on QE features.
When it happens
Trigger: Calling db.createCollection(name, { encryptedFields }) or letting the autoEncryption.encryptedFieldsMap drive creation against a 6.0-or-earlier MongoDB.
Common situations: Pointing a CSFLE/QE-enabled app at a dev cluster still on 6.0; upgrading the driver (which raised the minimum) without upgrading the server; mixing legacy FLE v1 (which worked on older servers) with new QE v2 code.
Related errors
- Snapshot reads require MongoDB 5.0 or later
- Cannot set both proxyOptions and kmsConnectCallback
- Can only provide a custom AWS credential provider when the s
- `cryptSharedLibRequired` set but no crypt_shared library loa
- Unable to connect to `mongocryptd`, please make sure it is r
AI-assisted analysis of mongodb/node-mongodb-native@dce7939f86 (2026-08-11).
Data as JSON: /api/errors/47a3953d9ebd8bfc.
Report an issue: GitHub.