Pipeline Practice

Measure each basket

`$set` enriches each document without discarding its existing fields. Expressions can read nested array values and calculate a new result.

Add an `itemCount` field containing the total quantity across each order’s items.

Expected result: Every order retains its fields and gains the correct item count.

Example pipeline syntax

[
  { $set: { itemCount: 0 } }
]