I don't know why chaining query helpers is not succeeding in this last challenge of MongoDB ( API and Microservices Certification) , Please Help

Tell us what’s happening:
My Code :

const queryChain = (done) => {
  const foodToSearch = "burrito";
  Person.find({ favoriteFoods : {$in : [foodToSearch]} })
  .sort({ name: 1 })
  .select({ age : 0 , name : 1 , favoriteFoods : 1 })
  .exec(function(error, people) {
    //do something here
    if (error) console.log(error) ;
    done(null , people) ;

Your project link(s)

solution: https://boilerplate-mongomongoose-1.vivekgusain.repl.co

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/90.0.4430.41 Safari/537.36.

Challenge: Chain Search Query Helpers to Narrow Search Results
Link to the challenge:*

Welcome, there.

Top Tip: Use the browser console to see the full assertion error:

At a glance, it looks like this is the issue:

… Pass the done(err, data) callback to exec() .

You are not doing this. Not directly, anyway

Hope this helps

1 Like

I’ve edited your post for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (’).

1 Like

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