Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{a:[{x:1},{y:1}]},{a:[{z:1}]},]
Query
db.collection.aggregate([{"$unwind":{path:"$a"}},{"$replaceRoot":{"newRoot":{"$mergeObjects":["$a"]}}}])
Result