When you implement aggregation operators, you build a new document that will be passed to the next level in the aggregation pipeline. The MongoDB aggregation framework provides a number of expression operators that help when computing values for new fields or when comparing existing fields in the documents.
When operating on a $group
aggregation pipe, multiple documents match the defined fields in the new documents created. MongoDB provides a set of operators you can apply to those documents and use to compute values for fields in the new group document based on values of fields in the original set of documents. Table 15.4 lists the $group
expression operators.
In addition, several string and arithmetic operators can be applied when computing new field values. Table 15.5 lists some of the most common operators that can be applied when computing new field values in the aggregation operators.