NEARBY key [CURSOR start] [LIMIT count] [SPARSE spread] [MATCH pattern] [DISTANCE] [WHERE field min max ...] [WHEREIN field count value [value ...] ...] [NOFIELDS] [FENCE] [DETECT what] [COMMANDS which] [COUNT|IDS|OBJECTS|POINTS|BOUNDS|(HASHES precision)] (POINT lat lon meters)|(ROAM key pattern meters)
The NEARBY command searches a collection for objects that intersect a specified radius.
This command has many options, but at it’s most simplest it may appear like.
Above is a search around the point
33.462,-112.268 with a radius of
6000 meters. A list of all objects that intersect that radius are returned.
For a complete list of search options please see the INTERSECTS command.
For a complete list of output formats please see the INTERSECTS command.
Normally the results of NEARBY are unsorted, but when a LIMIT is set with no radius, the KNN algorithm will be used instead of the standard overlap+Haversine algorithm, sorting the results in order of distance ascending, i.e., nearest first.
The following example will find the object closest to the given point: