var model = mongoose.model;
var createManyPeople = function(arrayOfPeople, done) {
model.create(arrayOfPeople, (err, data) => {
if(err) {
done(err);
}
done(null, data);
})
};
``` why my code is not working please somebody help
2 Likes
Please provide some additional information to allow others to help you.
For example:
-
What does it means ‘not working’?
Does it gives you an error? Does it saves just one document? Does it execute smoothly but it does not save anything? -
Is that all the code you have? Is there a repository somewhere?
-
Where the code runs?
A local environment? A glitch stuff?
A glitch stuff
this code not makin g any error but when I paste the URL in freecodecamp the challenge not pass
Try:
model.create(arrayOfPeople, (err, arrayOfPeople) =>
2 Likes
dear Mortaza,
here’s a bit of code that will certainly work for u:
var model = mongoose.model;
var createManyPeople = function(arrayOfPeople, done) {
model.create(arrayOfPeople,function (err, data){
if(err) return done(err);
done(null, data);
})
};