Create a basket snapshot
Array expressions can inspect a collection without changing the document grain. `$size` counts elements, while `$arrayElemAt` reads one position using a zero-based index.
Return `orderId`, `lineCount`, and `firstProductId` for every order. Count `items`, then read the first product ID without unwinding.
Expected result: Twelve compact basket summaries in the original order.
Example pipeline syntax
[
{ $project: { _id: 0, orderId: "$_id" } }
]