{"record":{"id":"82f635f07d7006f8","repo":"Automattic/mongoose","slug":"versionkey-must-be-falsy-or-string-got-typeo","errorCode":null,"errorMessage":"`versionKey` must be falsy or string, got `${typeof options.versionKey}`","messagePattern":"`versionKey` must be falsy or string, got `(.+?)`","errorType":"exception","errorClass":"MongooseError","httpStatus":null,"severity":"error","filePath":"lib/schema.js","lineNumber":641,"sourceCode":"    discriminatorKey: '__t',\n    shardKey: null,\n    read: null,\n    validateBeforeSave: true,\n    validateModifiedOnly: false,\n    // the following are only applied at construction time\n    _id: true,\n    id: defaultId,\n    typeKey: 'type',\n    ...options\n  };\n\n  // Treat `undefined` as \"not provided\" for these options\n  options.strict ??= defaultStrict;\n  options.strictQuery ??= defaultStrictQuery;\n  options.id ??= defaultId;\n\n  if (options.versionKey && typeof options.versionKey !== 'string') {\n    throw new MongooseError('`versionKey` must be falsy or string, got `' + (typeof options.versionKey) + '`');\n  }\n\n  if (typeof options.read === 'string') {\n    options.read = handleReadPreferenceAliases(options.read);\n  } else if (Array.isArray(options.read) && typeof options.read[0] === 'string') {\n    options.read = {\n      mode: handleReadPreferenceAliases(options.read[0]),\n      tags: options.read[1]\n    };\n  }\n\n  if (options.optimisticConcurrency && !options.versionKey) {\n    throw new MongooseError('Must set `versionKey` if using `optimisticConcurrency`');\n  }\n\n  return options;\n};\n","sourceCodeStart":623,"sourceCodeEnd":659,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/schema.js#L623-L659","documentation":"Error \"`versionKey` must be falsy or string, got `${typeof options.versionKey}`\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/schema.js:641 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"}