Working on an API I want to do a full document update of a MongoDB object.
This is my current code that works but it feels wrong to have to delete the _id every time. Is there a better way to do this?
PutDoco : function(doco){
return new Promise(function(Resolve,Reject){
delete doco._id;
db.collection('docos').updateOne(
{"details.ID":doco.details.ID},
doco,
function(err,result){
if(err)
return Reject(err);
Resolve(result);
}
);
});
},
via Bertus Kruger
No comments:
Post a Comment