Chain Search Query Helpers to Narrow Search Results

Do you understand the reason why this is not working?

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

This is the link here: boilerplate-mongomongoose - Replit

What are you trying to accomplish? In what way is it not working? What have you learned from your debugging so far?

1 Like

Your code is passing for me.

  • Are you getting any errors?

  • What does the network tab tell you?

Challenge: https://www.freecodecamp.org/learn/back-end-development-and-apis/mongodb-and-mongoose/chain-search-query-helpers-to-narrow-search-results

1 Like

My database was unconnected.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.