Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-74531

Exclude projection messed up the object fields order

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc1
    • None
    • 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

    Description

      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.

      Attachments

        Activity

          People

            andrew.paroski@mongodb.com Drew Paroski
            zixuan.zhuang@mongodb.com Zixuan Zhuang
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: