MongoDB and Mongoose - Use model.findOne() to Return a Single Matching Document from Your Database

Tell us what’s happening:

This is my code, and it gives me this answer. I think the code is correct, it follows the same pattern as the other functions.

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

###Your project link(s)

solution: https://3000-freecodecam-boilerplate-0mwidtcpqef.ws-eu108.gitpod.io

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.0.0 Safari/537.36 Edg/121.0.0.0

Challenge Information:

MongoDB and Mongoose - Use model.findOne() to Return a Single Matching Document from Your Database

did you try running this from other browsers? it might be blocking due to some “browser extensions”

happy coding :slight_smile:

Thanks for replying, I’ve been using freecodecamp for years and I’ve always used it from the Edge or Chrome and it hasn’t given me any problems.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.