Thanks! So I tried to explore with console logs, and I’m not even sure if my basic function is working. I tried console logging “peopleFound” and “personName,” but neither printed even when I attached text to the console log.
var findPeopleByName = function(personName, done) {
console.log(peopleFound + " Test1")
Person.find({name: personName}, function (err, peopleFound) {
console.log(peopleFound + "Test2");
if (err) return console.log(err);
done(null, peopleFound);
console.log(peopleFound + "Test3")
});
};
// Find all the people having a given name, using `Model.find() -> [Person]`
// In its simplest usage, `Model.find()` accepts a **query** document (a JSON
// object ) as the first argument, and returns an **array** of matches.
// It supports an extremely wide range of search options. Check it in the docs.
// Use the function argument `personName` as search key.
var findPeopleByName = function(personName, done) {
done(null/*, data*/);
};
Further down, the function (variable) is redefined. Delete this, and it should work.