Python эквивалент C # .Select?

Сделайте объект обновления с именами свойств, включая нужный путь. («somekey.» + из примера OP), а затем используйте это обновление.

//the modification that's requested
updateReq = { 
   param2 : "val2_new",
   param3 : "val3_new"   
}

//build a renamed version of the update request
var update = {};
for(var field in updateReq){
    update["somekey."+field] = updateReq[field];
}

//apply the update without modifying fields not originally in the update
db.collection.update({._id:...},{$set:update},{upsert:true},function(err,result){...});
13
задан mpen 8 November 2014 в 18:07
поделиться