Created
November 26, 2014 03:44
-
-
Save giobyte8/7b90542e0d10d7aea628 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Search all places in 'stores' collection that be 'near' of a given | |
* coordinates within a max distance of 2000 meters. collection 'stores' | |
* has a 2DSphere index on 'location' | |
*/ | |
db.stores.find({ | |
location: { | |
$near: { | |
$geometry: { | |
type: "Point", | |
coordinates: [ -123.528, 37.427] // Coordinates for 'hover tower' in Palo Alto | |
}, | |
$maxDistance: 2000 | |
} | |
} | |
}).pretty(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment