|
We decided to abandon this ticket due to implementation difficulty. Optimizing this kind of query was an extrapolation from the scope and not explicitly a requirement.
It's not clear how to optimize it without writing something that explicitly names the bucketing field. That is, we'd actually need to do:
{$unpackBucket: {exclude: [], metaField: "myMeta"}},
{$project : {myMeta.a : 1, myMeta.b: 1, _id: 0}}
--->
{$project : {meta.a : 1, meta.b: 1, data: 1}}
{$unpackBucket: {include: ['meta'], metaField: "myMeta"}},
We've avoided any rewrites up until this point that do this and we currently don't think it's worth relying on the bucket format not changing for a rewrite of marginal value which isn't clearly in scope.
|