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

Prevent dependency analysis from marking excluded fields as generated

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 7.0.0-rc0
    • None
    • None
    • None
    • Fully Compatible
    • ALL
    • QO 2023-04-17
    • 151

    Description

      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.

      Attachments

        Activity

          People

            ben.shteinfeld@mongodb.com Ben Shteinfeld
            ben.shteinfeld@mongodb.com Ben Shteinfeld
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: