I have a collection called test that I want to query with geoNear. The 2d index is set on the field loc.
Am I using db.runCommand correctly here?
db.open (err, client) ->
db.collection 'test', (err, collection) ->
db.runCommand {geoNear:"loc", near:[50,50], $maxDistance:1}, #callback here? what params?
I would normally do something like .toArray (err, docs) -> then then use the found docs but how sholud I implement the callback when using geoNear? It already returns an object with meta data right? How do I access it?
Thanks very much!
Yes, use:
db.command(params, callback)