Description
Here's an example using pymongo. I'm able to duplicate with different types of geo queries:
import re
from pymongo import Connection
coll = Connection().test.georegexlistfail
coll.ensure_index([('point', '2d'), ('words', 1)])
coll.insert({
'point': [1, 1],
'words': ['foo', 'bar']
})
q_regex =
{'words': re.compile('^f')}q_geo = {'point': {'$near':[1,1]}}
q_both =
def run(q):
print 'Query: %s' % str(q)
print 'Result: %s' % str(coll.find_one(q))
print
run(q_regex)
run(q_geo)
run(q_both)
"""
Output:
Query:
{'words': <_sre.SRE_Pattern object at 0x7f9fc21b63b0>}Result:
{u'_id': ObjectId('4d0be668b45b5d4d2d000000'), u'words': [u'foo', u'bar'], u'point': [1, 1]}Query: {'point': {'$near': [1, 1]}}
Result:
Query: {'words': <_sre.SRE_Pattern object at 0x7f9fc21b63b0>, 'point': {'$near': [1, 1]}}
Result: None
"""
Thanks!