Duplicate key error collection after using query method challenges

Duplicate key error collection after using query method challenges
0
#1

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…

Testing issues with mozilla firefox on Mongo DB/Mongoose challenges
#2

Hi,
it might not be very helpful to you, but I submitted your project link and it passed tests without an error. Not sure why you are seeing error.

#3

Actually It was quite helpful. I submitted my project link again, but this time running the fcc challenge page with google chrome instead of Mozilla and passed the tests.
It might be a navigator compatibility issue with FCC webpage. I think I should report this one to staff.

1 Like