MongoDB Geospatial CommandThe 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 commandThe 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. Syntax: It accepts the document that contains the following fields:
ExampleLet'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: Next TopicQuery and Write Operation Commands |