Mongoose findById is not accepted

Tell us what’s happening:
Describe your issue in detail here.
Clueless on why my solution is not accepted.

Code

const findPersonById = (personId, done) => {  
 
  Person.findById(personId,function(err,result){
    if (err){}
    else{
      done(null,result);
    }
  });
  /*
  Person.findOne({ _id: personId },function(err,result){
    if (err){}
    else{
      done(null,result);
    }
  });
  */
};

Your project link(s)

solution: https://replit.com/@gitsumakwel/boilerplate-mongomongoosefindbyidjs

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Firefox/78.0

Challenge: Use model.findById() to Search Your Database By _id

Link to the challenge:

Hello there,

I see you have modified the code quite a lot beyond what is asked. This may not necessarily be a problem, but still could be.

Otherwise, when I submit your app, I see this in the console:

I hope this helps you debug

1 Like

:grinning:
Done. It’s accepted.