Pipeline Practice

MongoDB $unwind

Turn each array element into its own output document.

After unwinding `items`, each output document contains one item instead of the whole items array. The surrounding order fields are repeated on every emitted document.

Stages are the top-level steps in a pipeline. Each stage receives documents, changes the stream in one specific way, and passes its output to the next stage.

Course use: Exercises 05, 10, 12, and Hard Mode 13.

Example pipeline syntax

{ $unwind: "$items" }