Could someone tell me if there is somehing wrong with my code? I checked on other posts concerning this topic and I think it’s right, but it won’t pass the test.
var queryChain = function(done) {
var foodToSearch = "burrito";
Person
.find({ favouriteFoods: foodToSearch })
.sort({name: 1})
.limit(2)
.select("-age")
.exec(function(err, data) {
console.log(data);
if (err) {
done(err);
}
done(null, data);
});
};
Challenge: MongoDB and Mongoose - Chain Search Query Helpers to Narrow Search Results
Link to the challenge: