Query.prototype.near()

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

Specifies a $near or $nearSphere condition

These operators return documents sorted by distance.

Example

  1. query.where('loc').near({ center: [10, 10] });
  2. query.where('loc').near({ center: [10, 10], maxDistance: 5 });
  3. query.where('loc').near({ center: [10, 10], maxDistance: 5, spherical: true });
  4. query.near('loc', { center: [10, 10], maxDistance: 5 });