MongoDB Geospatial Command
The Geospatial Command includes only one command, which is geoSearch. It is used to perform a geospatial query that utilizes MongoDB's haystack index functionality.
Haystack index: It increases searches by creating buckets of objects grouped by a second criterion.
MongoDB geoSearch command
The geoSerach command loaded with an interface that can be used by MongoDB's haystack index functionality. It is used to return a location-based results after collecting result based on some different queries such as haystack.
It accepts the document that contains the following fields:
Let's take the example of collection location:
The above command returns all the documents with a type of book store having a maximum distance of 8 units from the coordinates [ -73.96466, 40.78546 ] in the collection location up to a maximum of 50 results.
Overriding Default Read Concern
We can use the read concern option to override the default read concern level. As for example: