Mongo geolocation using $near and 2d index not being accurate Mongo geolocation using $near and 2d index not being accurate mongoose mongoose

Mongo geolocation using $near and 2d index not being accurate


No matter what type of geospatial indexing you use in MongoDB, you always must store longitude first and then latitude.

From http://docs.mongodb.org/manual/core/2d/#store-points-on-a-2d-plane and multiple other places in the docs:

Whether as an array or document, if you use longitude and latitude, store coordinates in this order: longitude, latitude.