MongoDB and Mongoose - Create and Save a Record of a Model

Tell us what’s happening:

I’m coding the exact issue which is being given in the problem but still im getting a server error messege ‘Missing ‘done()’ argument’

const createAndSavePerson = (done) => {
const person = new PersonModel({
name: “John Doe”,
age: 30,
favoriteFoods: [“pizza”, “pasta”]
});

person.save((err, data)=> {
if (err) return console.error(err);
done(null, data);
});
};

this is my code

###Your project link(s)

solution: http://localhost:3000

Your browser information:

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

Challenge Information:

MongoDB and Mongoose - Create and Save a Record of a Model

Welcome to the forum @anant1

Try using the Person model constructor you created earlier.

Happy coding

i changed it but its still not submitting

this is my updated code

const createAndSavePerson = (done) => {
const person = new Person({
name: “John Doe”,
age: 30,
favoriteFoods: [“pizza”, “pasta”]
});
console.log(“Saved Person:”, data);
person.save(function(err, data) {
if (err) return done(err);
return done(null,data);
});