Mongoose and findAndModify
You don't need to use findAndModify
for this as you don't need the original document. So you can just use update
like this:
MyModel.update({ _id: '52261c53daa9d6b74e00000c', someAdditionalFlag: 156}, { $set: {someAdditionalFlag: newValue }},function(err, numAffected) { ... });
In the callback, numAffected
will be 1 if a change was made, otherwise 0.