Neto, are you using the REST API or this with business logic?
N
Neto Leal
said
about 7 years ago
Hi Michael! I'm using both collection hook and iOS Framework
M
Mike
said
about 7 years ago
When using the iOS library (or the REST API) specify maxDistance in miles. When using business logic, such as with a collection hook, the maxDistance is specified in radians. (http://stackoverflow.com/questions/3878702/mongodb-bound-queries-how-do-i-convert-mile-to-radian might be helpful)
Neto Leal
metersToMiles = 0.000621371;
maxDistance = radiusInKilometers * 1000 * metersToMiles / 3963.192;
For example, for a radius of 15km the query body is the following:
{"_geoloc":{"$nearSphere":[-46.683750199999999,-23.594244364991852],"$maxDistance":0.0023517822846770287}}
any help?
thanks