db.posts.ensureIndex({"loc":"2d"})
If I do that and query by it…
What are the units?
db.posts.find({"loc": {"$within": {"$center" : [ user_center, user_radius ] }}})
What if I want to find something 5 miles away, what would my radius be?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
your unit is whatever you store there. If you store in degrees on a globe that will be your unit for a
$within.If you use degrees then the
$withinfor 5 miles will be ~ 0.07 since a degree is 60 nautical miles.