still it returns previous data. (data updates in database)
1 Like
Hi @JeevanKumar
If you’re using Mongoose, then { new: true } will work as expected and return the updated document.
But if you’re working with the native MongoDB Node.js driver, { new: true } won’t have any effect. Instead, you should use:
{ returnDocument: "after" }
So:
- Mongoose → use
{ new: true } - Native MongoDB driver → use
{ returnDocument: "after" }
That should fix it ![]()
2 Likes

