// set provider_account to 'first_account' for all ec2 envs with provider_account unset
db.projects.find().forEach(function(p) {
  var acc = "first_account";
  for (var i=0; i < p.deploy_envs.length ; i++) {
    var d = p.deploy_envs[i]; print(d.provider_account);
    if (d.provider == 'ec2' && !d.provider_account) {
      var key= "deploy_envs." + i + ".provider_account" ; print(key, p._id);
      var keyAcc = {};
      keyAcc[key] = acc;
      print(db.projects.update({_id: p._id}, {$set: keyAcc}))
    }
   }
})

