[SERVER-55668] Allow rewrite to push exclusion meta projections past $unpackBucket Created: 31/Mar/21  Updated: 29/Oct/23  Resolved: 20/Apr/21

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

Type: Task Priority: Major - P3
Reporter: Hana Pearlman Assignee: Hana Pearlman
Resolution: Fixed Votes: 0
Labels: None
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, Query Optimization 2021-05-03
Participants:

 Description   

If we have an exclusion $project only on meta after an $unpackBucket, we can move the $project before $unpackBucket. For example:

{$unpackBucket: {exclude: [], metaField: "myMeta"}},
{$project : {myMeta.a : 0, myMeta.b: 0}}
--->
{$project : {meta.a : 0, meta.b: 0}}
{$unpackBucket: {exclude: [], metaField: "myMeta"}},

We can do something similar when the exclusion $project is partially on meta. For example, after just the suggested optimization:

{$unpackBucket: {exclude: [], metaField: "myMeta"}},
{$project : {myMeta.a : 0, x: 0}}
--->
{$project : {meta.a : 0}}
{$unpackBucket: {exclude: [], metaField: "myMeta"}},
{$project :

{x: 0}

}



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

Author:

{'name': 'Hana Pearlman', 'email': 'hana.pearlman@mongodb.com', 'username': 'HanaPearlman'}

Message: SERVER-55668: Allow rewrite to push exclusion meta projections past $unpackBucket
Branch: master
https://github.com/mongodb/mongo/commit/b4d072aec9f92014020c275a05860f425a9fc374

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