Balakumar B
Balakumar B

Reputation: 790

How to run geosaptial Query in Mongo compass UI?

I have used Mongo Compass.. i want run following geospatial query in Mongo compass

db.restaurants.find( { location : { $geoWithin :
                             { $centerSphere :
                                [ [ 88 , 30 ] , 10 / 3963.2 ]
                  } } } )

Above Query is actual query. and also i have 2 collection these are restaurants and neighborhoods..

see following image enter image description here

Upvotes: 3

Views: 2655

Answers (2)

Jaumzera
Jaumzera

Reputation: 2359

You can also click at any point on the map, hold shift key and drag the pointer to somewhere else. It will build a query for you. So you can use it as a sample for building your own.

enter image description here

Upvotes: 3

Rudi
Rudi

Reputation: 2995

Try to enter only the query object into the input field, without db.restaurants.find... like so:

{ location : { $geoWithin :
                             { $centerSphere :
                                [ [ 88 , 30 ] , 10 / 3963.2 ]
                  } } }

Upvotes: 0

Related Questions