I’m trying to query my collection using geoSpatial query to return results near to a point, along with the distance from that point.
I’m using Queryable#near_sphere with Mongoid http://mongoid.org/en/origin/docs/selection.html
This executes the $nearSphere command on the query.
I’ve seen the geoNear command:
http://www.mongodb.org/display/DOCS/Geospatial+Indexing#GeospatialIndexing-geoNearCommand
This seems to return the results, with the calculated distance
Is there a way to either:
a) return the distance using nearSphere
b) use geoNear with Mongoid
I dont think this command is available on Origin, you might open a feature request if you wish https://github.com/mongoid/origin/issues.
As a work around you can issue the command straight from moped, something like this:
than you can put together your command, following the docs from mongodb.