Skip to content
Snippets Groups Projects
Commit 28e61771 authored by Alex Reisner's avatar Alex Reisner
Browse files

Document near queries with MongoDB.

parent 8d083a5e
No related branches found
No related tags found
No related merge requests found
...@@ -140,6 +140,12 @@ See _Advanced Geocoding_ below for more information about `Geocoder::Result` obj ...@@ -140,6 +140,12 @@ See _Advanced Geocoding_ below for more information about `Geocoder::Result` obj
Location-Aware Database Queries Location-Aware Database Queries
------------------------------- -------------------------------
### For Mongo-backed models:
Please use MongoDB's [geospatial query language](https://docs.mongodb.org/manual/reference/command/geoNear/). Mongoid also provides [a DSL](http://mongoid.github.io/en/mongoid/docs/querying.html#geo_near) for doing near queries.
### For ActiveRecord models:
To find objects by location, use the following scopes: To find objects by location, use the following scopes:
Venue.near('Omaha, NE, US', 20) # venues within 20 miles of Omaha Venue.near('Omaha, NE, US', 20) # venues within 20 miles of Omaha
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment