I created some schema.pre('save', function(){...}); validation, but then learned updates didn't trigger it. I really wanted the validation on updates, so I started doing this:
MySchema.findOne({...}, function(doc) {
doc.set(req.body);
doc.save(function(){...});
});
Is there any downside to doing this? It seems logical, but I haven't seen updates done this way as many times as I have seen them done with doc.update({}); or MySchema.findXxxAndUpdate({},{}). I realize update just passes everything through to the native driver, so set/save would incur some performance-penalties? How about atomicity?
The main downside to your approach is that you lose atomicity of your updates, because another update can occur in-between the time of your findOne call and the call to doc.save.
You also lose the power of the various update operators like $addToSet that provide tested logic that you would otherwise have to implement in code.