Open lairtonmendes opened 5 years ago
@lairtonmendes Maybe you can apply code bellow:
lat = params[:lat].to_f
lng = params[:lng].to_f
# i'm using distance with kilometer, if you using meter, please convert it.
radius = params[:distance].to_f / 111.12
radius_min = params[:distance_min].to_f / 111.12
aps = Model.where(location: { "$nearSphere": [lng, lat], "$maxDistance": radius, "$minDistance": radius_min}).to_a
Hello dear,
I need make this query below, but I need set the maxDistance por exemplo 1000 meters
Bar.nearby(my.location)
In MongoDB documentation
thank you very munch