var createManyPeople = function(arrayOfPeople, done) {
arrayOfPeople = [{name: 'John', age: 23, favoriteFoods:['Burger, Pizza']},
{name: 'Howard', age: 33, favoriteFoods:['Pasta, Sandwich']}];
Person.create(arrayOfPeople, function(err, data) {
if(err) {
return done(err);
}
else {
return done(null, arrayOfPeople);
}
});
}
Can anyone tell me whats the problem?
I think favoriteFoods
is supposed to be an array of foods, so it should be ['Burger', 'Pizza']
, etc.
Tried that, still getting the same error.
I think I got it. You’re not supposed to assign to the arrayOfPeople
variable. The tests will do that for you. The second argument for the last done()
call should also be data
, not arrayOfPeople
.
1 Like
var createManyPeople = function(arrayOfPeople, done) {
Person.create([
{name: 'John', age: 23, favoriteFoods:['Burger', 'Pizza']},
{name: 'Howard', age: 33, favoriteFoods:['Pasta', 'Sandwich']}], function(err, data) {
if(err) {
return done(err);
}
else {
return done(null, data);
}
});
}
Still getting the same error. 
Try passing arrayOfPeople
as the first argument for Person.create
(don’t make a new array)
3 Likes
Oh yes. That worked. I didn’t have to make any custom data. The tests do it automatically. Just passed arrayOfPeople
as the first argument and it worked! Thank you. 