Mongoose Query-Chaining

Tell us what’s happening:
Hello, i’m at the final phase of mongodb and mongoose challenge; chaining query.
i have passed the test but i don’t quite understand what’s going on in the code
how .sort({name: “asc”}) , that what confuses me. because to have name in ascending order({name: 1}) , descencending order({name: -1})

Your code so far

        var queryChain = function(done) {
  var foodToSearch = "burrito";
 const query = Person.find({favoriteFoods:foodToSearch})
 .sort({name:"asc"})
 .limit(2)
 .select({age: 0})
 .exec((err, people)=>{
   if(err) return console.log(err)
   done(null, people)
 })
};

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 6.2; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.183 Safari/537.36.

Challenge: Chain Search Query Helpers to Narrow Search Results

Link to the challenge:

Hello there,

What is confusing you? Here is the documentation: https://mongoosejs.com/docs/api.html#query_Query-sort

I suggest you give that a peruse first, then return if you still have any specific questions.

Hope that helps

Thanks i understand now.