How to get updated document back from the findOneAndUpdate method?

The Node.js driver documentation doesn’t mention a returnNewDocument option for findOneAndUpdate() (which is an option for the MongoDB shell command with the same name).

Instead, it mentions an option called returnOriginal, which defaults to true. Try using that option, setting it to false to return the updated document instead of the original.

Leave a Comment