const findAndUpdate = (personName, done) => {
const ageToSet = 20;
Person.findOneAndUpdate(
{ name: personName },
{ age: ageToSet },
{ new: true },
function (err, updatedDoc) {
if (err) return console.log(err);
done(null, updatedDoc);
},
);
};
I’m pretty sure this should work, after a few tries i asked chatgpt and it said the same, my connection to mongodb is working and my Person is defined properly, but the tests say:
findOneAndUpdate an item should succeed
Any ideas?
// Even after i now copied and pasted the solution for this one staight from the get a hint page it still doesn’t want to pass
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36 OPR/119.0.0.0
Challenge Information:
MongoDB and Mongoose - Perform New Updates on a Document Using model.findOneAndUpdate()