Hi folks, I’m facing hard time with database and MongoDB, Not because I don’t get the idea behind the task , no because whatever I do, my solutions did not pass the test !!!
In all tasks in this section none of my code work! when I go check the hint section and copy past (while my code is 99.99% identical) code, the test just pass ???
note: I’m working on this section on Replit website.
here is example =>
const findPeopleByName = function(personName, done) {
// CODE BELOW NOT PASSING THE TEST !!!
// Person.find({ name: personName }, function(data, err) {
// if (err) return console.log(err);
// done(null, data);
// });
// CODE BELOW PASS THE TEST !!!
// ANY EXPLANATION WHY ? WHAT IS THE DIFFERENCE
Person.find({ name: personName }, function(err, personFound) {
if (err) return console.log(err);
done(null, personFound);
});
};
The parameter order is not a user choice but a decision that was made for you when the API got created (in this case what is passed to the callback and in which order).