const query = { uuid: '12212121212112' };
const values = { $set: {name:'av'} };
const result = await databaseConnection.collection('person');
let data = await result.findOneAndUpdate(query, values, { new: true });
console.log(data) //old document getting printed
This is my code. In here I am using {new: true} but somehow still its returning the old document instead of the updated one.
Configuration is-
"mongodb": "^3.5.7",
"mongoose": "^5.9.17",
node version- v14.17.3
What is wrong with this?
P.S.- In another project with the same configuration it's working fine.