Classic engine may produce wrong field order for $project

XMLWordPrintableJSON

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

      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).

        1. repro.js
          0.8 kB
          Dan Larkin-York

            Assignee:
            [DO NOT USE] Backlog - Query Execution
            Reporter:
            Dan Larkin-York
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: