Database

[{"fooList":[{"bar":{"baz":100}},{"bar":{"baz":200}}]},{"fooList":[{"bar":{"baz":300}},{"bar":{"baz":400}}]}]

Query

db.collection.update({},[{$set:{fooList:{$map:{input:"$fooList",in:{$mergeObjects:["$$this",{$cond:[{$ne:["$$this.bar.baz",undefined]},{baz:"$$this.bar.baz"},{}]}]}}}}}],{multi:true})

Result