Mongo Playground

Configuration

[{"attributes":[{"attrId":"123","values":[{"name":"asd"},{"name":"bcc"}]},{"attrId":"456","values":[{"name":"zzz"},{"name":"bcc"}]}]},{"attributes":[{"attrId":"123","values":[{"name":"asd"},{"name":"bcc"}]},{"attrId":"456","values":[{"name":"kkk"},{"name":"bcc"}]}]},{"attributes":[{"attrId":"123","values":[{"name":"asd"},{"name":"bcc"}]},{"attrId":"456","values":[{"name":"kkk"},{"name":"bcc"}]}]}]

Query

db.collection.aggregate([{$group:{_id:null,root:{$push:"$$ROOT"},totalCount:{$sum:1}}},{$unwind:"$root"},{$unwind:"$root.attributes"},{$group:{_id:{attrId:"$root.attributes.attrId",values:"$root.attributes.values"},values:{$addToSet:{k:"$root.attributes.attrId",v:{$map:{input:"$root.attributes.values",in:"$$this.name"}}}},count:{$sum:1},totalCount:{$first:"$totalCount"}}},{$match:{$expr:{$eq:["$count","$totalCount"]}}},{$replaceRoot:{newRoot:{$arrayToObject:"$values"}}}])

Result