I would really like to do something like this:
db.events.aggregate({$geoNear:{near:[<longitude>, <latitude>], distanceField:"distance", query:{$text:{$search:<my search here>}}}})
I'm getting:
uncaught exception: aggregate failed: {
"errmsg" : "exception: geoNear command failed: { ok: 0.0, errmsg: \"Can't parse filter / create query\" }",
"code" : 16604,
"ok" : 0
}
I have successfully used the query on simple fields, but it won't work with text.
I know that there are general issues with combining special index types such as geo + text... for my use case though, I imagine that the geo search will really filter down my dataset, and after that point I don't care how fast the text filtering is.
My alternative that seems to work is:
db.events.find({loc:{$geoWithin:{$center: [<longitude>, <latitude>], <maxDistance>]}}, $text:{$search:<my search here>}})
The difference with this second query though is that I have to provide a <maxDistance>, I don't get the distance computed like I do with the geoNear's distanceField parameter... and thus I can't sort (and then limit) based on the distance.
Any help would be much appreciated!