Query.prototype.size()

Parameters
  • [path] «String»
  • val «Number»

Specifies a $size query condition.

When called with one argument, the most recent path passed to where() is used.

Example

  1. MyModel.where('tags').size(0).exec(function (err, docs) {
  2. if (err) return handleError(err);
  3. assert(Array.isArray(docs));
  4. console.log('documents with 0 tags', docs);
  5. })