Template
single collection
multiple collections
mgodatagen
update
indexe
explain
Stage
Database
bson
mgodatagen
[{_id:123,name:"xyz",attrib:{address:"123 xyz rd",phone:"123-456-7890"}}]
Query
db.collection.update({},[{$replaceRoot:{newRoot:{$mergeObjects:["$$ROOT","$attrib"]}}},{$unset:"attrib"}],{multi:true})
Result