MongoDB 8 · Aggregation

Flatten an array

Output one document per array element.

db.orders.aggregate([{ $unwind: "$items" }])

Official MongoDB 8 documentation

More aggregation commands

All aggregation commands · MongoDB 8 cheatsheet

Was this page helpful?