steevej
(Steeve Juneau)
2
We could help better if you share your aggregation. But without knowing more I can point you to $let which would be appropriate in some cases.
Another way it to use $addField to set temporary fields that you could use later as any other fields.