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

Iterating a RawBSONDocument does not preserve field order

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.8
    • Affects Version/s: None
    • Component/s: BSON
    • None

      I would expect that RawBSONDocument would maintain field ordering but it does not:

      >>> from bson.raw_bson import RawBSONDocument
      >>> from bson import BSON, SON
      >>> raw_doc = RawBSONDocument(BSON.encode(SON([('_id', 0), ('a', 2), ('b', 3), ('c', 4)])))
      >>> list(raw_doc)
      [u'a', u'c', u'_id', u'b']
      

            Assignee:
            prashant.mital Prashant Mital (Inactive)
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: