Watch keynotes and sessions from MongoDB.live, our virtual developer conference.

findOneAndUpdate isn't returning the new document

This function has one parameter “returnNewDocument”. we set this parameter to get the updated document.
i want bring into attention that its not working. It gives the old document.

please do the needful!!!

thanks
suraj

Could you provide example code and data that illustrate your claim?

Please add also the output of
mongo --version

At the time for preparing data for you guys, i though to directly try it in RoboMongo.

so i test create test collection and use findOneAndUpdate and found its working there.

so i think this is the problem in node.js which i am using.

Thanks to both of you and sorry for long delay reply. :slight_smile:

Thanks for the update and good luck!
Michael