MongoDB and Mongoose - Chain Search Query Helpers to Narrow Search Results

MongoDB and Mongoose - Chain Search Query Helpers to Narrow Search Results
0.0 0

#1

Not able to pass this challenge.

Can anyone see what’s wrong?

var queryChain = function(done) {
  var foodToSearch = "burrito";
  Person.find({favoriteFoods:foodToSearch}).sort({name : "desc"}).limit(2).select("-age").exec((err, data) => {
     if(err)
       done(err);
    done(null, data);
  })
};

https://learn.freecodecamp.org/apis-and-microservices/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results


#2

I got it. When sorting alphabetically, it has to be sorted in “asc” order not “desc” order.