0

I want to query $geoWithin with $or.

.find({"$or":[{"loc":{"$within":{"$center":[[79.853449,6.906746],5]}}},{"loc":{"$within":{"$center":[[10.853449,2.906746],5]}}}]})

and i get "$or may not contain 'special' query". what am i doing wrong? im using the latest mongodb

astroanu
  • 3,901
  • 2
  • 36
  • 50

1 Answers1

3

This feature (ability to include $geo queries inside $or clauses) was not supported in the current (2.4) or previous versions of MongoDB.

As of 2.5.5 (development release!) it will be supported, as well as in 2.6 production release. For details see https://jira.mongodb.org/browse/SERVER-3984

Asya Kamsky
  • 41,784
  • 5
  • 109
  • 133
  • Thanks for the info. Any suggestions on accomplishing this query? – astroanu Jan 08 '14 at 09:24
  • 1
    in 2.4 you would have to do it as two separate queries and merge the results yourself. You can also try 2.5.5 when it comes out (any day now). – Asya Kamsky Jan 08 '14 at 09:28
  • In case anyone is interested to know how i solved this: I manually calculated the near sphere using mongo execute. I know its not as accurate as what mongo does but this equation is almost okay. http://stackoverflow.com/a/6311501/626485 – astroanu Feb 03 '14 at 09:11