Automattic/mongoose · error · ObjectParameterError

Parameter "filter" to ${this.op}() must be an object, got "$

Error message

Parameter "filter" to ${this.op}() must be an object, got "${value}" (type ${typeof value})

What it means

Error "Parameter "filter" to ${this.op}() must be an object, got "${value}" (type ${typeof value})" thrown in Automattic/mongoose.

Source

Thrown at lib/query.js:531

  p[path] = { $slice: val };
  this.select(p);

  return this;
};

/*!
 * ignore
 */

const validOpsSet = new Set(queryMiddlewareFunctions);

Query.prototype._validateOp = function() {
  if (this.op != null && !validOpsSet.has(this.op)) {
    this.error(new Error('Query has invalid `op`: "' + this.op + '"'));
  }

  if (this.op !== 'estimatedDocumentCount' && this._conditions == null) {
    throw new ObjectParameterError(this._conditions, 'filter', this.op);
  }
};

/**
 * Specifies the complementary comparison value for paths specified with `where()`
 *
 * #### Example:
 *
 *     User.where('age').equals(49);
 *
 *     // is the same as
 *
 *     User.where('age', 49);
 *
 * @method equals
 * @memberOf Query
 * @instance
 * @param {object} val

View on GitHub (pinned to 49cdab0136)

When it happens

Trigger: Thrown at lib/query.js:531 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/0823966957427eae. Report an issue: GitHub.