MongoDB and Mongoose - Create and Save issue

I am getting Missing callback argument error

Here is my work


var createManyPeople = function(arrayOfPeople, done) {
    const person = new Person({name:"Joe",age:"20",favoriteFoods:["rice"]})
    person.save(function(err,data){
      if(err){
        done(err);
      }
    done(null, data);
    });    
};

Can anyone help me find what I am missing out

When you defined done did you put the second parameter as optional? If not you’re calling done(err) without the second argument, hence the Missing callback argument error^^

For createManyPeople you should be using the Model.create method (see https://mongoosejs.com/docs/api.html#model_Model.create)