Prevent dependency analysis from marking excluded fields as generated

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 7.0.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • ALL
    • QO 2023-04-17
    • 151
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      SERVER-25120 introduced a concept of generated fields in the context of pipeline dependency analysis. This allowed us to avoid pushing down fields into the PlanStage/find layer which were actually introduced (generated) later in the pipeline. The implementation treats exclusion projections as fields which are generated. The problem with this is that if we later has an inclusion projection on the same field, we omit that field as a dependency for the pipeline and don't pushdown the field to the find layer. This is ok for non-dotted paths, for yields different results for dotted paths.

      db.c.insert({"_id": 1, "obj": {"str": "abc"}})
      db.c.aggregate([{$project: {"obj.str": 0}}, {$project: {"obj.str": 1}}])
      
      // Before SERVER-25120
      [{_id: 1, obj: {}}]
      
      // After SERVER-25120
      [{_id: 1}]

      We need to pushdown 'obj.str' into the find layer to maintain correct query results.

            Assignee:
            Ben Shteinfeld
            Reporter:
            Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: