MongoDB and Mongoose - Create Many Records with model.create() what is wrong with my code please help me

MongoDB and Mongoose - Create Many Records with model.create() what is wrong with my code please help me
0

#1

var Model = mongoose.model;
var createManyPeople = function(arrayOfPeople, done) {
Model.create(arrayOfPeople, (err, data) => {
if(err) {
done(err);
}
done(null, data);
})
};


#2

Can you format your code next time with preformatted text in the editor next time?

You can’t use Mode.create. You need to call .create on person model which you created in the previous exercise.


#3

Solution:

var createManyPeople = function(arrayOfPeople, done) {
Person.create(arrayOfPeople, (err, data) => {
if(err) {
done(err);
}
done(null, data);
})
};