Fixed problem of ordering when using near_sphere operator

This commit is contained in:
Matthieu Rigal
2015-06-21 03:24:05 +02:00
parent 5efabdcea3
commit d96fcdb35c
2 changed files with 2 additions and 8 deletions

View File

@@ -128,7 +128,8 @@ def query(_doc_cls=None, _field_operation=False, **query):
mongo_query[key].update(value)
# $max/minDistance needs to come last - convert to SON
value_dict = mongo_query[key]
if ('$maxDistance' in value_dict or '$minDistance' in value_dict) and '$near' in value_dict:
if ('$maxDistance' in value_dict or '$minDistance' in value_dict) and \
('$near' in value_dict or '$nearSphere' in value_dict):
value_son = SON()
for k, v in value_dict.iteritems():
if k == '$maxDistance' or k == '$minDistance':