alonho / pql

A python expression to MongoDB query translator
BSD 3-Clause "New" or "Revised" License
224 stars 27 forks source link

Bug on $near query #23

Closed mesarvagya closed 7 years ago

mesarvagya commented 7 years ago

There is an error while creating query for GeoQueries, especially near. Your example location == near([1, 2], 10) generates {'location': SON([('$near', [1, 2]), ('$maxDistance', 10)])}, where SON([( is some random characters (possibly missing { and } ). It is replicated for location == near(Point(1, 2), 10) and location == nearSphere(Point(1, 2)) . Thanks.

alonho commented 7 years ago

It's not a bug. SON([('a', 1), ('b', 2)]) is actually an ordered dictionary implemented by pymongo (python's dictionary is unordered).