1

Any means currently built out in Mongoid to use $geoWithin without storing anything in the db?

Wanting to be able to just use $geoWithin (or another similar method) by just calling it on some object that has the coordinates and subsequently passing the polygonal boundaries.

Thoughts?

1 Answer 1

0

Have you used geo_near?

This worked for me

center = [lat.to_f, lon.to_f]
User.geo_near(center).max_distance(10)

User model definition:

field :location, type:Array  # [lat,lng]
index( { location: "2d" }, { min: -180, max: 180 })

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.