Tell us what’s happening:
Not sure what is wrong with my code, I did check the hint and follow it. The logs does not show anything relevant at well. I tried to change to different syntax for select or sort as in documentation and also assign a variable for Person.find() query before chaining methods but it also doesnt work. The notification in FCC log said that “Chaining query helpers should succeed”.
Your code so far
var queryChain = function(done) {
var foodToSearch = "burrito";
Person.find({ favoriteFoods: [foodToSearch] })
.sort({ name: 1 })
.limit(2)
.select({ age: 0 })
.exec(function(error, data) {
if (error) return console.log(error);
done(null,data)
});
};
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) coc_coc_browser/87.0.152 Chrome/81.0.4044.152 Safari/537.36
.
Challenge: Chain Search Query Helpers to Narrow Search Results
Link to the challenge: