Exclude projection messed up the object fields order

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.1.0-rc0, 7.0.0-rc1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • v7.0
    • QE 2023-03-06, QE 2023-03-20, QE 2023-04-03, QE 2023-04-17, QE 2023-05-01
    • 35
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SBE re-orders the fields in bson with the project stage {$project: {"obj.obj.obj.obj.array": 0}}.

      In SBE's implementation, the object {obj: xx, any:xx } is first copied without specific field excluded from projections (obj in this case), then append the field back if only part of the object is excluded (only obj.array is excluded in this case). With this algorithm, the fields order is changed after projection stage.

      When there is a $lookup stage with self-lookup after the project stage, the re-ordered object can't be matched to the original object, and output incorrect result.

            Assignee:
            Drew Paroski
            Reporter:
            Zixuan Zhuang
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: