MongoDB and Mongoose - Use model.find() to Search Your Database

Tell us what’s happening:
When I run tests, I get:
“Find all items corresponding to a criteria should succeed”

I’m completely stuck. I don’t have any idea to fix this.

Your project link(s)

solution: boilerplate-mongomongoose - Node.js Repl - Replit

Your browser information:

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

Challenge: MongoDB and Mongoose - Use model.find() to Search Your Database

Link to the challenge:

As a sidenote, the callback to connect may not run, instead of using const you need to use function.

I don’t have a Mongo URL to test, but you can try executing the function, and console.logging the result to check that everything looks fine

When I fork your project and provide my own MONGO_URI, your code passes the test. Are you seeing any errors in the Node console or your browser console when submitting the url? What url are you submitting?

1 Like

I work on the starter project of FreeCodeCamp on Replit. I submit the url like : https://boilerplate-mongomongoose.paulpiazza.repl.co.

In the Replit console, I only get

POST
[Object object]

Thank you for your response and your hint! I opened the console on the Freecodecamp submitting page and I can see errors.

My cluster was not cleared before testing. Test tried to put a new record called ‘random’ which was already present in my docs. It was a unique key constraint violation. I fixed it.

thanks

1 Like