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

Allow rewrite to push computed meta projections past $unpackBucket

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.0.0-rc0
    • Affects Version/s: None
    • Component/s: Querying
    • Labels:
    • Fully Compatible
    • Query Optimization 2021-04-05, Query Optimization 2021-04-19

      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

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

              Created:
              Updated:
              Resolved: