Implementing Aggregation Expression Operators

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.

Table 15.4 Aggregation $group expression ...

Get Node.js, MongoDB, and AngularJS Web Development 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.