Reputation: 45
My aggregation is this.
These are result..
I wanna get bottom result.
How to aggregate this result ?
Upvotes: 2
Views: 4460
Reputation: 46441
You can use $project
, $unwind
and $replaceRoot
aggregation pipeline stages after $facet
db.collection.aggregate([
{ "$project": {
"data": { "$concatArrays": ["$all", "$part"] }
}},
{ "$unwind": "$data" },
{ "$replaceRoot": { "newRoot": "$data" } }
])
Upvotes: 8