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

can't retrieve a document by sub-document if the elements are not in the exact same order

    • Type: Icon: Task Task
    • Resolution: Done
    • Priority: Icon: Minor - P4 Minor - P4
    • None
    • Affects Version/s: 2.6.3
    • Component/s: None
    • Labels:
      None

      if you create a document with mongo like this :
      db.test.insert({x:1, d: {a:1, b:2, c:3}})

      db.test.find({d: {a:1, b:2, c:3}})
      gives the document back.

      now, if try to retrieve it in python :
      db.test.find(dict(d=

      {'a': 1, 'b': 2, 'c': 3}

      ))
      I don't get any document.

      it is ok when I "extend" the dict like this :
      db.test.find(

      {'d.a': 1, 'd.b': 2, 'd.c': 3}

      )

      I then tried again under mongo to change the order of the elements in the d array:
      db.test.find({d: {a:1, c:3, b:2}})
      gives no result.

      Is it a bug or a feature to considerthat

      {a: 1, b:2, c:3}

      is different than

      {a:1, c:3, b:2}

      ??

      In python, they are equals...

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            rj-10gen@arsynet.com Remi Jolin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: