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.
See this post to find the backtick on your keyboard. The “preformatted text” tool in the editor (</>) will also add backticks around text.
Note: Backticks are not single quotes.
To help your question: If you have run the script to create a model, and it was not 100% correct to begin with, then your database has an incorrect collection, and you could try:
Going into your Mongo account, and clearing all records.
Re-running the tests/script.
Or
Go back to the first challenge, and concurrently complete all of them again.
Just wanted to update this, I was struggling with this and this was good advice! But it took me a bit of research to clear all records.
When you start with Mongo, as is not specified in the challenges, you have to create a collection. I created one (database name “dbtest” and collection name also “dbtest”) and then you have to change the bit in your URI to whatever you set it to. Was having trouble just because there was no collection for Mongo to access. Hope this helps, this challenge took me forever to pass
Good point. This could do with mentioning during the first lesson, in case Campers get stuck.
This is not quite true, because the default URI contains 'test' (mentioned here). Also, using Mongoose (as this challenge does) automatically creates a database (typically with the same name as the collection).
Ah! Also, I didn’t end up fixing it lol, about to post again.
but yes, thank you for responding! On me for not seeing the default URL bit.
Also, seems like fCC has migrated to Glitch? All of the challenges in this section cite Repl.it but all of the responses on the forum suggest using Glitch. Might be useful to change some of those (I was thinking of sending in PRs over the next few days for what it’s worth, just have been busy!)
Will read the contributor docs! Have seen a few things I wanted to tweak but have not gotten around to setting up an environment/actually tweaking things.
Was mainly thinking something like “NOTE: We were previously encouraging campers to use Glitch instead of Repl.it, so posts on the freeCodeCamp forum may refer to Glitch. Most of this advice is applicable to projects on Repl.it as well.” or something like that but perhaps more eloquent.
where do I find the records in my Mongo DB
Actually, I passed the test (my error was not putting quotes around the string items in the array), but I double checked the cluster in my Mongo DB and could find no data there