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

var findPersonById = function(personId, done) {
Person.findById(personId, function (err, data) {
if (err) return console.log(err);
done(null, data);
});
};

I have use the above code . Also try to use ai and hint which is provided but it always shows the following error:
// running tests
Find an item by Id should succeed
// tests completed
// console output
[Error: Person validation failed: age: Path age (0) is less than minimum allowed value (18).]

Note : this is the link if any one want to view
https://replit.com/join/xyrmmbnneh-ayushmaheshwar8

Hi there. I’d recommend using Gitpod over Repl.it these days as Repl.it changed their pricing model. That being said, I don’t think that’s quite the line giving you a problem. Rather it could be a symptom of something else.

Can you let us see the rest of it? I wanna pay extra close attention to how you register and create Person objects.

Remove the min constraint on the age from the schema. I wouldn’t suggest you add anything to the schema that isn’t asked for.


Also, just so you know the way you shared the Replit your connection string is available to anyone. I would change it after you are done and not share that publicly.

1 Like

i have provided the link of invitation

thanks for the help .

1 Like

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