Issue in findOneandUpdate method - mongodb atlas

I’m facing an issue with the findOneAndUpdate method. I recently upgraded my MongoDB driver to version 6.17. Everything seems to be working fine except for one thing: when I update a document, it gets updated in the database, but the method doesn’t return anything. Specifically, res.value, res.error, and res.lastErrorObject are all undefined. I don’t understand why nothing is being returned.

I really appreciate any help!

Thanks,

Please share your code. You mentioned version 6.17 but did no mentioned which language, js, python, java …

If using nodejs, most likely you are missing an await.

2 Likes

@Vivek_Chavda, have you made progress on this?

We still do not know which programming language you are using.

Have you found the solution? Please share, this will help other like you that may face the same.

If the issue was the missing await in js, please mark my post as the solution.