Automattic/mongoose · error · MongooseError
Unrecognized bulkWrite() operation name ${op.name}
Error message
Unrecognized bulkWrite() operation name ${op.name} What it means
Error "Unrecognized bulkWrite() operation name ${op.name}" thrown in Automattic/mongoose.
Source
Thrown at lib/connection.js:481
options = { ...options, session: asyncLocalStorage.session };
}
const now = this.base.now();
let res = null;
if (ordered) {
const opsToSend = [];
for (const op of ops) {
if (typeof op.model !== 'string' && !op.model?.[modelSymbol]) {
throw new MongooseError('Must specify model in Connection.prototype.bulkWrite() operations');
}
const Model = op.model[modelSymbol] ? op.model : this.model(op.model);
if (op.name == null) {
throw new MongooseError('Must specify operation name in Connection.prototype.bulkWrite()');
}
if (!Object.hasOwn(castBulkWrite.cast, op.name)) {
throw new MongooseError(`Unrecognized bulkWrite() operation name ${op.name}`);
}
await castBulkWrite.cast[op.name](Model, op, options, now);
opsToSend.push({ ...op, namespace: Model.namespace() });
}
res = await this.client.bulkWrite(opsToSend, options);
} else {
const validOps = [];
const validOpIndexes = [];
let validationErrors = [];
const asyncValidations = [];
const results = [];
for (let i = 0; i < ops.length; ++i) {
const op = ops[i];
if (typeof op.model !== 'string' && !op.model?.[modelSymbol]) {
const error = new MongooseError('Must specify model in Connection.prototype.bulkWrite() operations');
validationErrors.push({ index: i, error: error });View on GitHub (pinned to 49cdab0136)
When it happens
Trigger: Thrown at lib/connection.js:481 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/9b3b0cce51519e5a.
Report an issue: GitHub.