cfmongodb icon indicating copy to clipboard operation
cfmongodb copied to clipboard

Add Geo support in SearchBuilder.cfc

Open marcesher opened this issue 14 years ago • 0 comments

Mongo Supports lightweight geospatial searching, described here: http://www.mongodb.org/display/DOCS/Geospatial+Indexing

I've added an ensureGeoIndex function into Mongo.cfc for creating the indexes, and you can currently use cfmongodb. to perform geo queries like so:

nearResult = mongo.query( collection ).add( "LOC", {"$near" = [38,-85]} ).search(limit=10);

But this is not idiomatic CFMongoDB and I'd like to add functions in SearchBuilder for building up the handful of geo queries.

I'm thinking something like:

mongo.query(coll).$near(field, min, max);

mongo.query(coll).$near(field, min, max, maxDistance);

we'd want support for $within, both "box" and "center", which would probably translate into

withinBox(..) and withinCenter(...)

Anything else?

marcesher avatar Dec 21 '10 02:12 marcesher