- Reference >
- Database Commands >
- Geospatial Commands >
- geoSearch
geoSearch¶
-
geoSearch¶ The
geoSearchcommand provides an interface to MongoDB’s haystack index functionality. These indexes are useful for returning results based on location coordinates after collecting results based on some other query (i.e. a “haystack.”) Consider the following example:The above command returns all documents with a
typeofrestauranthaving a maximum distance of 6 units from the coordinates[30,33]in the collectionplacesup to a maximum of 30 results.Unless specified otherwise, the
geoSearchcommand limits results to 50 documents.Important
geoSearchis not supported for sharded clusters.