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

Classic engine may produce wrong field order for $project

    • Type: Icon: Bug Bug
    • Resolution: Won't Fix
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Query Execution
    • ALL

      It's not exactly clear what the absolute minimal reproducer is here, but it seems that for certain combinations of arrays, sub-objects, and computed projections, the classic engine can produce output with fields reordered relative to their position in the inclusion projection.

      For example, given an input document

      {
        _id: 1,
        'array': [],
        'obj': {},
      }
      

      and pipeline

      [{$project: {
        'array': [],
        'obj.array': []
      }}]
      

      we produce

      {
        '_id': 1,
        'obj': {'array': []},
        'array': []
      }
      

      This problem seems to go back quite a long way (at least 4.2), but was recently surfaced by the aggregation_optimization_fuzzer in BF-24359 (it appears we do not have the same behavior in SBE).

            Assignee:
            backlog-query-execution [DO NOT USE] Backlog - Query Execution
            Reporter:
            dan.larkin-york@mongodb.com Dan Larkin-York
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: