Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Maximum distance with Mongoid's Model.near method
- Place.near(:coordinates => location.reverse)
- # must reverse the resulting coordinates array because mongo stores them backwards [lng,lat]
- db.places.find( { loc : { $near : [50,50] , $maxDistance : 5 } } )
- Place.where(:coordinates => {"$near" => location.reverse , '$maxDistance' => 20.fdiv(69)})
Add Comment
Please, Sign In to add comment