Automattic/mongoose · error
MONGOOSE
MONGOOSE
Error message
mongoose: calling `save()` on a subdoc does **not** save the document to MongoDB, it only runs save middleware. Use `subdoc.save({ suppressWarning: true })` to hide this warning if you're sure this behavior is right for your app. What it means
Error "mongoose: calling `save()` on a subdoc does **not** save the document to MongoDB, it only runs save middleware. Use `subdoc.save({ suppressWarning: true })` to hide this warning if you're sure this behavior is right for your app." thrown in Automattic/mongoose.
Source
Thrown at lib/types/subdocument.js:76
*
* #### Note:
*
* _This is a no-op. Does not actually save the doc to the db._
*
* @param {object} [options]
* @param {boolean} [options.suppressWarning=false] If `true`, suppress the warning about calling `save()` on a subdoc.
* @param {boolean|object} [options.middleware=true] set to `false` to skip all user-defined middleware
* @param {boolean} [options.middleware.pre=true] set to `false` to skip only pre hooks
* @param {boolean} [options.middleware.post=true] set to `false` to skip only post hooks
* @return {Promise} resolved Promise
* @api private
*/
Subdocument.prototype.save = async function save(options) {
options = options || {};
if (!options.suppressWarning) {
utils.warn('mongoose: calling `save()` on a subdoc does **not** save ' +
'the document to MongoDB, it only runs save middleware. ' +
'Use `subdoc.save({ suppressWarning: true })` to hide this warning ' +
'if you\'re sure this behavior is right for your app.');
}
return await this.$__save(options);
};
/**
* Given a path relative to this document, return the path relative
* to the top-level document.
* @param {string} path
* @method $__fullPath
* @memberOf Subdocument
* @instance
* @returns {string}
* @api private
*/View on GitHub (pinned to 49cdab0136)
When it happens
Trigger: Thrown at lib/types/subdocument.js:76 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/ffe946b97001f0be.
Report an issue: GitHub.