Automattic/mongoose · error · MongooseError
Model.populate() no longer accepts a callback
Error message
Model.populate() no longer accepts a callback
What it means
Error "Model.populate() no longer accepts a callback" thrown in Automattic/mongoose.
Source
Thrown at lib/model.js:4480
* @param {boolean} [options.retainNullValues=false] By default, Mongoose removes null and undefined values from populated arrays. Use this option to make `populate()` retain `null` and `undefined` array entries.
* @param {boolean} [options.getters=false] If true, Mongoose will call any getters defined on the `localField`. By default, Mongoose gets the raw value of `localField`. For example, you would need to set this option to `true` if you wanted to [add a `lowercase` getter to your `localField`](https://mongoosejs.com/docs/schematypes.html#schematype-options).
* @param {boolean} [options.clone=false] When you do `BlogPost.find().populate('author')`, blog posts with the same author will share 1 copy of an `author` doc. Enable this option to make Mongoose clone populated docs before assigning them.
* @param {object|Function} [options.match=null] Add an additional filter to the populate query. Can be a filter object containing [MongoDB query syntax](https://www.mongodb.com/docs/manual/tutorial/query-documents/), or a function that returns a filter object.
* @param {boolean} [options.skipInvalidIds=false] By default, Mongoose throws a cast error if `localField` and `foreignField` schemas don't line up. If you enable this option, Mongoose will instead filter out any `localField` properties that cannot be casted to `foreignField`'s schema type.
* @param {number} [options.perDocumentLimit=null] For legacy reasons, `limit` with `populate()` may give incorrect results because it only executes a single query for every document being populated. If you set `perDocumentLimit`, Mongoose will ensure correct `limit` per document by executing a separate query for each document to `populate()`. For example, `.find().populate({ path: 'test', perDocumentLimit: 2 })` will execute 2 additional queries if `.find()` returns 2 documents.
* @param {boolean} [options.strictPopulate=true] Set to false to allow populating paths that aren't defined in the given model's schema.
* @param {object} [options.options=null] Additional options like `limit` and `lean`.
* @param {Function} [options.transform=null] Function that Mongoose will call on every populated document that allows you to transform the populated document.
* @param {boolean} [options.forceRepopulate=true] Set to `false` to prevent Mongoose from repopulating paths that are already populated
* @param {boolean} [options.ordered=false] Set to `true` to execute any populate queries one at a time, as opposed to in parallel. Set this option to `true` if populating multiple paths or paths with multiple models in transactions.
* @return {Promise}
* @api public
*/
Model.populate = async function populate(docs, paths) {
_checkContext(this, 'populate');
if (typeof paths === 'function' || typeof arguments[2] === 'function') {
throw new MongooseError('Model.populate() no longer accepts a callback');
}
// normalized paths
paths = utils.populate(paths);
if (paths.length === 0) {
return docs;
}
// each path has its own query options and must be executed separately
if (paths.find(p => p.ordered)) {
// Populate in series, primarily for transactions because MongoDB doesn't support multiple operations on
// one transaction in parallel.
// Note that if _any_ path has `ordered`, we make the top-level populate `ordered` as well.
for (const path of paths) {
await _populatePath(this, docs, path);
}
} else {
// By default, populate in parallelView on GitHub (pinned to 49cdab0136)
When it happens
Trigger: Thrown at lib/model.js:4480 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Automattic/mongoose@49cdab0136 (2026-08-21).
Data as JSON: /api/errors/726842a2d9d9df4f.
Report an issue: GitHub.