yes I removed return from both done(null, data) and done(err), and I have var findAndUpdate = function(personName, done). I don’t know what i’m doing wrong
Hi! I have just been having the same problem, i added some default values to this schema so when the check code is run, the favouriteFoods is “unknown” and this is not in my default values at schema.
Comment out the array you created in the “Create many People with Model.create()”
/** 4) Create many People with `Model.create()` */
// Sometimes you need to create many Instances of your Models,
// e.g. when seeding a database with initial data. `Model.create()`
// takes an array of objects like [{name: 'John', ...}, {...}, ...],
// as the 1st argument, and saves them all in the db.
// Create many people using `Model.create()`, using the function argument
// 'arrayOfPeople'.
/*
var arrayOfPeople = [
{
name: 'Mary Doe',
age: 2,
favoriteFoods: ["Egg", "Yammy"]
},
{
name: 'Kovani Roe',
age: 15,
favoriteFoods: ["Rice", "Yam"]
},
{
name: 'Seth Jane',
age: 25,
favoriteFoods: ["Fish", "Yam"]
}
];
*/
var createManyPeople = function(arrayOfPeople, done) {
Person.create(arrayOfPeople, (err, data) => {
err ? done(err) : done(null, data);
});
};