Tell us what’s happening:
To complete the challenge I am using the following query which even giving me the output that the challenge is asking, but the thing is this answer is not getting expected and I am not sure what am I doing wrong here.
Here is the code:
Person.find({favoriteFoods: foodToSearch})
.sort({name: 'asc'})
.limit(2)
.select('-age')
.exec((err, data) => {
if(err) return console.log(err);
console.log(data);
done(null,data);
})
Your project link(s)
solution: boilerplate-mongomongoose-1 - Replit
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/101.0.4951.54 Safari/537.36 Edg/101.0.1210.39
Challenge: Chain Search Query Helpers to Narrow Search Results
Link to the challenge: