Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-292

Geospatial queries parameters orders

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.0.1
    • Component/s: None
    • Environment:
      Python 2.7.1
      Django non-rel 1.3
      MongoDB 2.0.1
      PyMongo 2.0.1
      Django Mongo DB Engine 0.4

      I was trying to execute a geospatial query to find the nearest documents from django using django mongo db engine:

      MyModel.objects.raw_query({'location' : {'$near' : [55.55632, 25.13522], '$maxDistance' : 0.01}})

      And kept getting "geo values have to be numbers" error, I couldn't find helpful resources about this problem, but when I tried to reverse the order of the dictionary it succeeded:

      MyModel.objects.raw_query({'location' : {'$maxDistance' : 0.01, '$near' : [55.55632, 25.13522]}})

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            mpcabd Abd Allah Diab
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: