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

Allow rewrite to push computed meta projections past $unpackBucket

    XMLWordPrintable

Details

    • Task
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • 5.0.0-rc0
    • Querying
    • Fully Compatible
    • Query Optimization 2021-04-05, Query Optimization 2021-04-19

    Description

      If we have an $addFields on both meta and bucket data, it would be worth to be able to split the $addFields into two parts - one depending only on the metadata, and another containing rest of the fields. The first part can then be pushed down. For example (approximately):

      {$unpackBucket: {exclude: []}},
      {$addFields : {newmeta : "$meta.foo", bar: "$x"}}
      -->
      {$addFields: {newmeta : "$meta.foo"}}
      {$unpackBucket: {exclude: []}},
      {$addFields: {bar: "$x"}}
      with 'newmeta' field added to the specification of the bucket in $unpackBucket

      Attachments

        Activity

          People

            milena.ivanova@mongodb.com Milena Ivanova
            jacob.evans@mongodb.com Jacob Evans
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: