MongoDB and Mongoose - Perform New Updates on a Document Using model.findOneAndUpdate()

Tell us what’s happening:

Hello my code ithink is true but the system detech not true thx

###Your project link(s)

solution: https://3000-freecodecam-boilerplate-4y0efkxqcqo.ws-us110.gitpod.io

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36

Challenge Information:

MongoDB and Mongoose - Perform New Updates on a Document Using model.findOneAndUpdate()

Hey there,

Please update the message to include your code. The code was not automatically inserted by the help button.

When you enter a code, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

Hello Thx for respon :v: , anyway this is my code:

const findAndUpdate =  (personName, done) => {
  
  const ageToSet = 20;

  Person.findOneAndUpdate({ name: personName }, { age: ageToSet }, { new: true }, (err, data) => {
    
    if(err) {
       return console.log(err);
    }else{
      done(null,data)
      return data
    }
  })
}; 

Your code is passing for me.

Please post a GitHub repo or share a workspace snapshot (remove your env file first).

Remember to restart the server. Also, if your server is running right now it should load for us, but it doesn’t load for me.

This my gitpod for this trouble :
https://freecodecam-boilerplate-4y0efkxqcqo.ws-us110.gitpod.io/

Your response object has

"favoriteFoods": ["none"]

But it should be

"favoriteFoods": ["unknown"]

Not sure how that is happening with the body payload being

{
  name: 'Dorian Gray',
  age: 35,
  favoriteFoods: ['unknown']
}

I would need to see the rest of your code.

Tests:
https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/05-back-end-development-and-apis/mongodb-and-mongoose/perform-new-updates-on-a-document-using-model.findoneandupdate.md