{"record":{"id":"6cf2412b4745afb7","repo":"Automattic/mongoose","slug":"can-not-use-limit-and-perdocumentlimit-at-the","errorCode":null,"errorMessage":"Can not use `limit` and `perDocumentLimit` at the same time. Path: `${obj.path}`.","messagePattern":"Can not use `limit` and `perDocumentLimit` at the same time\\. Path: `(.+?)`\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"lib/options/populateOptions.js","lineNumber":21,"sourceCode":"const clone = require('../helpers/clone');\n\nclass PopulateOptions {\n  constructor(obj) {\n    this._docs = {};\n    this._childDocs = [];\n\n    if (obj == null) {\n      return;\n    }\n    obj = clone(obj);\n    Object.assign(this, obj);\n    if (typeof obj.subPopulate === 'object') {\n      this.populate = obj.subPopulate;\n    }\n\n\n    if (obj.perDocumentLimit != null && obj.limit != null) {\n      throw new Error('Can not use `limit` and `perDocumentLimit` at the same time. Path: `' + obj.path + '`.');\n    }\n  }\n}\n\n/**\n * The connection used to look up models by name. If not specified, Mongoose\n * will default to using the connection associated with the model in\n * `PopulateOptions#model`.\n *\n * @memberOf PopulateOptions\n * @property {Connection} connection\n * @api public\n */\n\nmodule.exports = PopulateOptions;\n","sourceCodeStart":3,"sourceCodeEnd":37,"githubUrl":"https://github.com/Automattic/mongoose/blob/49cdab01366679723b487ecb754b38570f783289/lib/options/populateOptions.js#L3-L37","documentation":"Error \"Can not use `limit` and `perDocumentLimit` at the same time. Path: `${obj.path}`.\" thrown in Automattic/mongoose.","triggerScenarios":"Thrown at lib/options/populateOptions.js:21 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"}