Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{_id:1,data:[7,4,0]},{_id:2,data:[4,5,6]},{_id:3,data:[6,7,8]}]
Query
db.collection.aggregate([{$match:{_id:{$in:[1,2]}}},{$unwind:"$data"},{$group:{_id:null,data:{$addToSet:"$data"}}}])
Result