MongoDB and Mongoose - Create and Save a Record of a Model

Tell us what’s happening:
Describe your issue in detail here.
Hello can anyone help me , I am stuck here on this problem for a week and I can’t solve it , you can find my code on github

Your project link(s)

solution: GitHub - Yacineos/boilerplate-mongomongoose: A boilerplate for the freeCodeCamp curriculum.

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/ Safari/537.36

Challenge: MongoDB and Mongoose - Create and Save a Record of a Model

Link to the challenge:

const mongoose = require(‘mongoose’)
mongoose.connect(process.env.MONGO_URI, { useNewUrlParser: true })

const personSchema = new mongoose.Schema({
name: String,
age: Number,
favoriteFoods: [String]

const Person = mongoose.model(‘Person’, personSchema)

const createAndSavePerson = function(done) {
const yacine = new Person({name: ‘Joe’, age: 21, favoriteFoods: [‘pizza’, ‘burger’]});, data) => {
if (err) {
done(null, data);

and this is the .env file :

-----------------------------------------I give up

When I use my own MONGO_URI string, your code passes the challenge. Hopefully, you are putting the actual password for the database user named yacine where you currently have <test.1.2.3> unless that is the password. Also, you need to make sure to put a database named after the but before the ?. It can be named anything, but there needs to be something there. I would suggest something like fcc-monoose-challenges.

I can’t pass the tests , even though I created a new user(fcc) for the DB , made sure that the name is correct the password(fcc) correct , the IP adress ( made it from anywhere , and as you told me I added db1 as database name( I made that name up ) and added it after the / and before ? I can’t find the issue !


my problem is solved by changing my DNS to