I have the following Meteor method:
'updateDoc': function (doc, obj) {
Movies.update(
{_id: doc},
{$set: {field1: obj.key1, field2: obj.key2, field3: obj.key3} }
);
},
The problem is that obj
creates dynamically and, for example, may not include key2
. Is there any way to exclude appropriate field from update function to avoid overwriting to null in that case?