Query.prototype.$where()

Parameters
  • js «String|Function» javascript string or function
Returns:
  • «Query» this

Specifies a javascript function or expression to pass to MongoDBs query system.

Example

  1. query.$where('this.comments.length === 10 || this.name.length === 5')
  2. // or
  3. query.$where(function () {
  4. return this.comments.length === 10 || this.name.length === 5;
  5. })

NOTE:

Only use $where when you have a condition that cannot be met using other MongoDB operators like $lt. Be sure to read about all of its caveats before using.