Hey. This is my glitch project link.
More specifically:
var findPeopleByName = function(personName, done) {
Person.find({name: personName},(err,aName)=> err? done(err):done(null,aName));
};
/** 6) Use `Model.findOne()` */
// `Model.findOne()` behaves like `.find()`, but it returns **only one**
// document, even if there are more. It is especially useful
// when searching by properties that you have declared as unique.
// Find just one person which has a certain food in her favorites,
// using `Model.findOne() -> Person`. Use the function
// argument `food` as search key
var findOneByFood = function(food, done) {
Person.findOne({favoriteFoods: food},(err,bite)=> err? done(err):done(null,bite));
};
I want to find out why after implementing query methods such as model.find and findOne, I get this error on the fcc challenge console:
E11000 Duplicate key error collection…