Pipeline Practice

MongoDB $project

Choose, remove, rename, or calculate output fields.

A value of `1` keeps a field and `0` removes it. Assign a field path such as `"$_id"` when you want to rename or copy a value.

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 02, 05, 08, 10, 12, and Hard Mode 13.

Example pipeline syntax

{ $project: { _id: 0, orderId: "$_id", total: 1 } }