Details
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