{"record":{"id":"47a3953d9ebd8bfc","repo":"mongodb/node-mongodb-native","slug":"invalid-qe-version-the-minimum-server-version-r","errorCode":null,"errorMessage":"${INVALID_QE_VERSION} The minimum server version required is ${MIN_SUPPORTED_QE_SERVER_VERSION}","messagePattern":"(.+?) The minimum server version required is (.+?)","errorType":"exception","errorClass":"MongoCompatibilityError","httpStatus":null,"severity":"error","filePath":"src/operations/create_collection.ts","lineNumber":169,"sourceCode":"  const timeoutContext = TimeoutContext.create({\n    session: options.session,\n    serverSelectionTimeoutMS: db.client.s.options.serverSelectionTimeoutMS,\n    waitQueueTimeoutMS: db.client.s.options.waitQueueTimeoutMS,\n    timeoutMS: options.timeoutMS\n  });\n\n  const encryptedFields: Document | undefined =\n    options.encryptedFields ??\n    db.client.s.options.autoEncryption?.encryptedFieldsMap?.[`${db.databaseName}.${name}`];\n\n  if (encryptedFields) {\n    class CreateSupportingFLEv2CollectionOperation extends CreateCollectionOperation {\n      override buildCommandDocument(connection: Connection, session?: ClientSession): Document {\n        if (\n          !connection.description.loadBalanced &&\n          maxWireVersion(connection) < MIN_SUPPORTED_QE_WIRE_VERSION\n        ) {\n          throw new MongoCompatibilityError(\n            `${INVALID_QE_VERSION} The minimum server version required is ${MIN_SUPPORTED_QE_SERVER_VERSION}`\n          );\n        }\n\n        return super.buildCommandDocument(connection, session);\n      }\n    }\n\n    // Create auxilliary collections for queryable encryption support.\n    const escCollection = encryptedFields.escCollection ?? `enxcol_.${name}.esc`;\n    const ecocCollection = encryptedFields.ecocCollection ?? `enxcol_.${name}.ecoc`;\n\n    for (const collectionName of [escCollection, ecocCollection]) {\n      const createOp = new CreateSupportingFLEv2CollectionOperation(db, collectionName, {\n        clusteredIndex: {\n          key: { _id: 1 },\n          unique: true\n        },","sourceCodeStart":151,"sourceCodeEnd":187,"githubUrl":"https://github.com/mongodb/node-mongodb-native/blob/dce7939f86fb283e167ad709955abedb7bf23124/src/operations/create_collection.ts#L151-L187","documentation":"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.","triggerScenarios":"Calling db.createCollection(name, { encryptedFields }) or letting the autoEncryption.encryptedFieldsMap drive creation against a 6.0-or-earlier MongoDB.","commonSituations":"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.","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."],"exampleFix":"// before — server is 6.0\nawait db.createCollection('patients', { encryptedFields });\n\n// after — upgrade server to 7.0+, then the same call works","handlingStrategy":"validation","validationCode":"const hello = await db.command('hello');\nif (options.encryptedFields && hello.maxWireVersion < 21) {\n  throw new Error('Queryable Encryption requires MongoDB 7.0+ (wire version 21)');\n}\nawait db.createCollection(name, options);","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Check db.hello().maxWireVersion before issuing createCollection with encryptedFields.","Pin your server major version when relying on QE features."],"tags":["csfle","queryable-encryption","server-version","compatibility"],"backgroundTag":null,"analyzedSha":"dce7939f86fb283e167ad709955abedb7bf23124","analyzedAt":"2026-08-11T04:54:53.215Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}