In addition to expression operators, there are a number of operators referred to as accumulators (https://docs.mongodb.com/manual/meta/aggregation-quick-reference/#accumulators-group), which are used in conjunction with $group, $project, and $addFields. This form of operator spans all the documents in the pipeline and produces an aggregate result.
Aggregation pipeline accumulators
Get MongoDB 4 Quick Start Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.