I am trying to complete the challenge https://www.freecodecamp.org/learn/back-end-development-and-apis/mongodb-and-mongoose/create-and-save-a-record-of-a-model
my code seems not to work and I do not know why
this is the boiler plate link
Your project link(s)
Your browser information:
Did you setup the MONGO_URI
environment variable with your mongo db credentials in the Secrets section of the replit?
Can you post a screenshot of your Node console when you click the Run
button in the replit?
I forked your replit, added my own mongo credentials for the MONGO_URI
environment variable, and was able to pass the challenge with your code.



The first screen shot is my secret to connect to mongodb with my password covered
and the other two are the console before and after I submit the code on freecode camp
Are you sure you gave your mongo user the correct permissions and allowed any ip address to access your app under the Network Access
section of Mongo atlas?
I allowed any ip address
I do not understand what you mean by correct permissions
I gave admin the access without any specific restriction
Try forking the project and adding the MONGO_URI again to the Secrets section. It could be the current replit is just corrupt.
Also, this might seem like a dumb question, but did you stop and restart the project after making the code changes to myApps.js
for the challenge?
May I ask do I need to include the database name in the uri
Yes, you need a database name in the uri. It can be anything.
I always restart each time I make a change
I figured it out. I just noticed that your user does not have read and write privileges. You need to click EDIT
for the user and on the next screen, under Built-in Role, you need to select Read and write to any database
. These instructions were in the tutorial shown in the first challenge of this curriculum section.
Thank you, it works now that was an omission on my end