[SERVER-54001] Allow rewrite to push computed meta projections past $unpackBucket Created: 22/Jan/21  Updated: 29/Oct/23  Resolved: 07/Apr/21

Status: Closed
Project: Core Server
Component/s: Querying
Affects Version/s: None
Fix Version/s: 5.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Jacob Evans Assignee: Milena Ivanova
Resolution: Fixed Votes: 0
Labels: qopt-team
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Query Optimization 2021-04-05, Query Optimization 2021-04-19
Participants:

 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



 Comments   
Comment by Githook User [ 06/Apr/21 ]

Author:

{'name': 'Milena Ivanova', 'email': 'milena.ivanova@mongodb.com', 'username': 'mivanova3'}

Message: SERVER-54001 Allow rewrite to push computed meta projections past $unpackBucket

Split $addFields to two parts, dependent and independent from the meta field,
and push the dependent part past $unpackBucket.
Branch: master
https://github.com/mongodb/mongo/commit/2dbc4a91be463c37a1a38396b6c52a06d67042fb

Generated at Thu Feb 08 05:32:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.