MongoDB Use model.findOne()

Tell us what’s happening:
I am having difficulty completing this challenge. I was able to complete the previous challenge using Model.find(); but this one is not passing any data into my unnamed function (console.log is printing null), and I don’t know how the testing function works well enough to troubleshoot. Could someone tell me if I’m making some sort of simple error that I’m not seeing, or if there is a problem with the testing algorithm?

Your code so far

var findOneByFood = function(food, done) {
  Person.findOne({favoriteFood: food}, function(err, data) {
    console.log(data);
    if(err) return done(err);
    return done(null, data)
  })
  
};

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36.

Link to the challenge:

it’s favoriteFoods, plural.

Dang, it’s always something simple. Thanks for the second pair of eyes!

Lol…Stuck for 1 hour with the exact mistake scratching my head. Thank you so much

Found the problem, need to use function(err,obj) instead:

Auth.findOne({nick: 'noname'}, function(err,obj) { console.log(obj); });