Created
December 10, 2015 12:50
-
-
Save cristopher-rodrigues/88d7bf6f514dd620c40d to your computer and use it in GitHub Desktop.
mongo simple geolocation search
This file contains hidden or 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
let q = { | |
miles: 40, //mile pointOf earth radius | |
earth: 3963.2, //earth radius | |
lat: -25, | |
long: -49 | |
}; | |
db.collection.find({$geoWithin: {$centerSphere: [[q.lat, q.long], q.miles/q.earth]}}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment