Why use aggregation?

A practical use for single-purpose aggregation is to present results in a certain order (via sorting), and limiting the number of results which appear at the end of a query. A more complex form of aggregation, the aggregation pipeline, might be used to:

In the former case, single-purpose aggregation is not useful if you want to sort the values in an array, which is embedded in a document. As for the latter case, a sharded cluster is where you have a subset of the database distributed across a set of servers which are networked together. Aggregation ...

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.