Query.prototype.mod()

Parameters
  • [path] «String»
  • val «Array» must be of length 2, first element is divisor, 2nd element is remainder.
Returns:
  • «Query» this

Specifies a $mod condition, filters documents for documents whose path property is a number that is equal to remainder modulo divisor.

Example

  1. // All find products whose inventory is odd
  2. Product.find().mod('inventory', [2, 1]);
  3. Product.find().where('inventory').mod([2, 1]);
  4. // This syntax is a little strange, but supported.
  5. Product.find().where('inventory').mod(2, 1);