Database

[{_id:1,name:"One",attribute_bag:{lights:{type:"basic",value:"8"},doors:{type:"basic",value:"7"}}},{_id:2,name:"Two",attribute_bag:{switches:{type:"basic",value:"2"}}},{_id:3,name:"Three",attribute_bag:{windows:{type:"basic",value:"8"},color:{type:"descriptive",value:"blue"}}}]

Query

db.collection.aggregate([{$replaceRoot:{newRoot:{$mergeObjects:[{_id:"$_id",name:"$name"},{$arrayToObject:{$map:{input:{$objectToArray:"$attribute_bag"},in:["$$this.k","$$this.v.value"]}}}]}}}])

Result