This is very interesting question! I've been struggling with this too! Lot's of googling, but the answer was just in MongoDB documentation.
From here you can learn that:
For spherical query operators to function properly, you must convert distances to radians, and convert from radians to the distances units used by your application.
To convert:
- distance to radians: divide the distance by the radius of the sphere (e.g. the Earth) in the same units as the distance measurement.
- radians to distance: multiply the radian measure by the radius of the sphere (e.g. the Earth) in the units system that you want to convert the distance to.
The radius of the Earth is approximately 3,959 miles or 6,371 kilometers.
How can we use it? Try this:
db.places.find( { location: { $geoWithin: { $centerSphere: [ [ 12.948430, 77.573868 ] ,
100 / 6371 ] } } } )
Please be advised, I used this technique and it worked for MongoDB 2.6.
Hope that helps!
Good luck!