{"record":{"id":"223c9bda3189ec7d","repo":"Automattic/mongoose","slug":"mongoose-223c9b","errorCode":"MONGOOSE","errorMessage":"Mongoose: `Document.prototype.validateSync()` is deprecated and will be removed in Mongoose 10. Use `Document.prototype.validate()` instead.","messagePattern":"Mongoose: `Document\\.prototype\\.validateSync\\(\\)` is deprecated and will be removed in Mongoose 10\\. Use `Document\\.prototype\\.validate\\(\\)` instead\\.","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/document.js","lineNumber":3411,"sourceCode":" *\n *     const err = doc.validateSync();\n *     if (err) {\n *       handleError(err);\n *     } else {\n *       // validation passed\n *     }\n *\n * @param {Array|string} [pathsToValidate] only validate the given paths\n * @param {object} [options] options for validation\n * @param {boolean} [options.validateModifiedOnly=false] If `true`, Mongoose will only validate modified paths, as opposed to modified paths and `required` paths.\n * @param {Array|string} [options.pathsToSkip] list of paths to skip. If set, Mongoose will validate every modified path that is not in this list.\n * @return {ValidationError|undefined} ValidationError if there are errors during validation, or undefined if there is no error.\n * @deprecated Use `validate()` instead. `validateSync()` does not run middleware and will be removed in Mongoose 10.\n * @api public\n */\n\nDocument.prototype.validateSync = function() {\n  utils.warn('Mongoose: `Document.prototype.validateSync()` is deprecated and will be removed in Mongoose 10. Use `Document.prototype.validate()` instead.');\n  return this.$__validateSync.apply(this, arguments);\n};\n\n/*!\n * ignore\n */\n\nDocument.prototype.$__validateSync = function(pathsToValidate, options) {\n  const _this = this;\n\n  if (arguments.length === 1 && typeof arguments[0] === 'object' && !Array.isArray(arguments[0])) {\n    options = arguments[0];\n    pathsToValidate = null;\n  }\n\n  const hasValidateModifiedOnlyOption = options &&\n      (typeof options === 'object') &&\n      ('validateModifiedOnly' in options);","sourceCodeStart":3393,"sourceCodeEnd":3429,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/document.js#L3393-L3429","documentation":"Error \"Mongoose: `Document.prototype.validateSync()` is deprecated and will be removed in Mongoose 10. Use `Document.prototype.validate()` instead.\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/document.js:3411 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"}