Iterating a RawBSONDocument does not preserve field order

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Minor - P4
    • 3.8
    • Affects Version/s: None
    • Component/s: BSON
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • 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 (Inactive)
              Reporter:
              Shane Harvey
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: