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

Classic engine may produce wrong field order for $project

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Won't Fix
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • Query Execution
    • ALL

    Description

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

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: