I have +10k points (latitude, longitude) and I\'m building an app that shows you the k nearest points to a user\'s location.
I think this is a very common problem and I
If you want to use MongoDB, then read their docs carefully. The default model is flat earth. It assumes that a degree of longitude has the same length as a degree of latitude.
I quote: """The current implementation assumes an idealized model of a flat earth, meaning that an arcdegree of latitude (y) and longitude (x) represent the same distance everywhere. This is only true at the equator where they are both about equal to 69 miles or 111km. However, at the 10gen offices at { x : -74 , y : 40.74 } one arcdegree of longitude is about 52 miles or 83 km (latitude is unchanged). This means that something 1 mile to the north would seem closer than something 1 mile to the east."""
You need their "new spherical model". Be warned: you need to use (longtitude, latitude) in that order -- again, read their docs carefully.