Automattic/mongoose · error · MongooseError
updateMany `update` parameter cannot be nullish
Error message
updateMany `update` parameter cannot be nullish
What it means
Error "updateMany `update` parameter cannot be nullish" thrown in Automattic/mongoose.
Source
Thrown at lib/model.js:4082
* @param {object} [options] optional see [`Query.prototype.setOptions()`](https://mongoosejs.com/docs/api/query.html#Query.prototype.setOptions())
* @param {boolean|'throw'} [options.strict] overwrites the schema's [strict mode option](https://mongoosejs.com/docs/guide.html#strict)
* @param {boolean} [options.upsert=false] if true, and no documents found, insert a new document
* @param {object} [options.writeConcern=null] sets the [write concern](https://www.mongodb.com/docs/manual/reference/write-concern/) for replica sets. Overrides the [schema-level write concern](https://mongoosejs.com/docs/guide.html#writeConcern)
* @param {boolean} [options.timestamps=null] If set to `false` and [schema-level timestamps](https://mongoosejs.com/docs/guide.html#timestamps) are enabled, skip timestamps for this update. Does nothing if schema-level timestamps are not set.
* @param {boolean} [options.translateAliases=null] If set to `true`, translates any schema-defined aliases in `filter`, `projection`, `update`, and `distinct`. Throws an error if there are any conflicts where both alias and raw property are defined on the same object.
* @param {boolean} [options.overwriteDiscriminatorKey=false] Mongoose removes discriminator key updates from `update` by default, set `overwriteDiscriminatorKey` to `true` to allow updating the discriminator key
* @return {Query}
* @see Query docs https://mongoosejs.com/docs/queries.html
* @see MongoDB docs https://www.mongodb.com/docs/manual/reference/command/update/#update-command-output
* @see UpdateResult https://mongodb.github.io/node-mongodb-native/7.0/interfaces/UpdateResult.html
* @api public
*/
Model.updateMany = function updateMany(conditions, update, options) {
_checkContext(this, 'updateMany');
if (update == null) {
throw new MongooseError('updateMany `update` parameter cannot be nullish');
}
return _update(this, 'updateMany', conditions, update, options);
};
/**
* Update _only_ the first document that matches `filter`.
*
* - Use `replaceOne()` if you want to overwrite an entire document rather than using atomic operators like `$set`.
*
* #### Example:
*
* const res = await Person.updateOne({ name: 'Jean-Luc Picard' }, { ship: 'USS Enterprise' });
* res.matchedCount; // Number of documents matched
* res.modifiedCount; // Number of documents modified
* res.acknowledged; // Boolean indicating the MongoDB server received the operation. This may be false if Mongoose did not send an update to the server because the update was empty.
* res.upsertedId; // null or an id containing a document that had to be upserted.
* res.upsertedCount; // Number indicating how many documents had to be upserted. Will either be 0 or 1.View on GitHub (pinned to 49cdab0136)
When it happens
Trigger: Thrown at lib/model.js:4082 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/4787665e6fc7002b.
Report an issue: GitHub.