Docs Menu
Docs Home
/ /
/ / / /

Unwind Arrays and Group Data

This tutorial illustrates how to construct an aggregation pipeline, perform the aggregation on a collection, and display the results using the language of your choice.

This tutorial demonstrates how to create insights from customer order data. The results show the list of products ordered that cost more than $15. Each document contains the number of units sold and the total sale value for each product.

The aggregation pipeline performs the following operations:

  • Unwinds an array field into separate documents

  • Matches a subset of documents by a field value

  • Groups documents by common field values

  • Adds computed fields to each result document

The following steps demonstrate how to create and run an aggregation pipeline to unpack array fields into separate documents and compute new values based on groups of common values.

Back

Group and Total

On this page