Model.where()

Parameters
  • path «String»
  • [val] «Object» optional value
Returns:
  • «Query»

Creates a Query, applies the passed conditions, and returns the Query.

For example, instead of writing:

  1. User.find({age: {$gte: 21, $lte: 65}}, callback);

we can instead write:

  1. User.where('age').gte(21).lte(65).exec(callback);

Since the Query class also supports where you can continue chaining

  1. User
  2. .where('age').gte(21).lte(65)
  3. .where('name', /^b/i)
  4. ... etc