{"record":{"id":"23aebbd5a0866b15","repo":"Automattic/mongoose","slug":"invalid-encryptiontype-encryptiontype","errorCode":null,"errorMessage":"invalid `encryptionType`: ${encryptionType}","messagePattern":"invalid `encryptionType`: (.+?)","errorType":"exception","errorClass":"MongooseError","httpStatus":null,"severity":"error","filePath":"lib/schema.js","lineNumber":757,"sourceCode":"  const defaultOptions = Object.assign({}, baseOptions, schemaOptions);\n\n  this._defaultToObjectOptionsMap = this._defaultToObjectOptionsMap || {};\n  this._defaultToObjectOptionsMap[path] = utils.hasOwnKeys(defaultOptions) ? defaultOptions : null;\n  return defaultOptions;\n};\n\n/**\n * Sets the encryption type of the schema, if a value is provided, otherwise\n * returns the encryption type.\n *\n * @param {'csfle' | 'queryableEncryption' | null | undefined} encryptionType plain object with paths to add, or another schema\n */\nSchema.prototype.encryptionType = function encryptionType(encryptionType) {\n  if (arguments.length === 0) {\n    return this.options.encryptionType;\n  }\n  if (!(typeof encryptionType === 'string' || encryptionType === null)) {\n    throw new MongooseError(`invalid \\`encryptionType\\`: ${encryptionType}`);\n  }\n  this.options.encryptionType = encryptionType;\n};\n\n/**\n * Adds key path / schema type pairs to this schema.\n *\n * #### Example:\n *\n *     const ToySchema = new Schema();\n *     ToySchema.add({ name: 'string', color: 'string', price: 'number' });\n *\n *     const TurboManSchema = new Schema();\n *     // You can also `add()` another schema and copy over all paths, virtuals,\n *     // getters, setters, indexes, methods, and statics.\n *     TurboManSchema.add(ToySchema).add({ year: Number });\n *\n * @param {object|Schema} obj plain object with paths to add, or another schema","sourceCodeStart":739,"sourceCodeEnd":775,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/schema.js#L739-L775","documentation":"Error \"invalid `encryptionType`: ${encryptionType}\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/schema.js:757 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49cdab01366679723b487ecb754b38570f783289","analyzedAt":"2026-08-21T22:54:00.882Z","schemaVersion":2},"datasetVersion":"2026-08-21T23:17:16.201Z"}