# MongoDB and Mongoose - Install and Set Up Mongoose Problem

**URL:** <https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907>\
**Category:** General\
**Created:** [July 23, 2019, 7:27pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907 "2019-07-23T19:27:16Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![luisnunezar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/luisnunezar/32/120370_2.png) [@luisnunezar](https://forum.freecodecamp.org/u/luisnunezar)\
**Post date:** [July 23, 2019, 7:27pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/1 "2019-07-23T19:27:16Z")

</div>

Hi, i’m having a problem with the first challenge of this lesson. I have already done everything but y still get this message.

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/b/f/bf41ec9ab888aef51fc84cf0a89f95098d17ffea.png)

This is my code so far:

.env

myApp.js

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/3/b/3b836bee97078e3853067c66f86806b85a2d27b0.png)

package.json  
 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/6/1/618e980724b0dc27b62cb1adede8929e43972ba3.png)

And this is the config of the IP Whitelist in Atlas

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/a/d/add7f477573085dd795f723c462c04a82d11e75c.png)

I would appreciate very much any help.

---

<div class="post-metadata">

**Author:** ![alkapwn3d](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/alkapwn3d/32/92787_2.png) [@alkapwn3d](https://forum.freecodecamp.org/u/alkapwn3d)\
**Post date:** [July 23, 2019, 7:38pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/2 "2019-07-23T19:38:04Z")

</div>

how come you didnt use the mongo\_url in your .env file?

---

<div class="post-metadata">

**Author:** ![luisnunezar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/luisnunezar/32/120370_2.png) [@luisnunezar](https://forum.freecodecamp.org/u/luisnunezar)\
**Post date:** [July 23, 2019, 7:41pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/3 "2019-07-23T19:41:44Z")

</div>

Because i was searching the problem, but it makes no difference, i get the same result if i use the MONGO\_URI

---

<div class="post-metadata">

**Author:** ![eoja](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/eoja/32/135387_2.png) [@eoja](https://forum.freecodecamp.org/u/eoja)\
**Post date:** [July 24, 2019, 3:25am UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/4 "2019-07-24T03:25:20Z")

</div>

Because I can’t give you a hint in any way to help, I’ll just say if you use MONGO\_URI you have to delete everything after the question mark.

If you don’t use that you need the question mark at the end of your connection.

I’ve answered this before and I’ll add I don’t know why the query makes it not work, but it doesn’t work with the query after the question mark.

---

<div class="post-metadata">

**Author:** ![luisnunezar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/luisnunezar/32/120370_2.png) [@luisnunezar](https://forum.freecodecamp.org/u/luisnunezar)\
**Post date:** [July 24, 2019, 1:32pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/5 "2019-07-24T13:32:42Z")

</div>

I just checked that, but i still can’t connect Mongoose to the database.

---

<div class="post-metadata">

**Author:** ![eoja](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/eoja/32/135387_2.png) [@eoja](https://forum.freecodecamp.org/u/eoja)\
**Post date:** [July 24, 2019, 4:47pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/6 "2019-07-24T16:47:17Z")

</div>

Also never use quotes in the `.env` file.

---

<div class="post-metadata">

**Author:** ![luisnunezar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/luisnunezar/32/120370_2.png) [@luisnunezar](https://forum.freecodecamp.org/u/luisnunezar)\
**Post date:** [July 24, 2019, 6:07pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/7 "2019-07-24T18:07:00Z")

</div>

If i take the quotes i get this error in the glich console:

 ![image](https://global.discourse-cdn.com/freecodecamp/original/3X/b/c/bce7257b5a777faa3dbc95f7ef2c5356d0eea64e.png)

Any ideas?

---

<div class="post-metadata">

**Author:** ![eoja](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/eoja/32/135387_2.png) [@eoja](https://forum.freecodecamp.org/u/eoja)\
**Post date:** [July 24, 2019, 6:40pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/8 "2019-07-24T18:40:00Z")

</div>

With the little code of yours that I see, it’s a little hard to say. But the directions say " Connect to the database using mongoose.connect()".

The directions don’t say to use a variable.

---

<div class="post-metadata">

**Author:** ![luisnunezar](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/luisnunezar/32/120370_2.png) [@luisnunezar](https://forum.freecodecamp.org/u/luisnunezar)\
**Post date:** [July 24, 2019, 7:50pm UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/9 "2019-07-24T19:50:19Z")

</div>

I reinstalled all the dependencies and it no longer shows me the error, but I still fail the test.

---

<div class="post-metadata">

**Author:** ![eoja](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/eoja/32/135387_2.png) [@eoja](https://forum.freecodecamp.org/u/eoja)\
**Post date:** [July 25, 2019, 1:48am UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/10 "2019-07-25T01:48:19Z")

</div>

Did you stop using the variable? Also, you can include a callback function to log an error or log you are connected. Like

```auto
... {useNewUrlParser: true},
  function(err) {
    if (err) { console.log(err); }
    else { console.log("Connected to db!") };
});

```

Then you will see the error or “Connected to db!” in your log.

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [January 17, 2021, 9:33am UTC](https://forum.freecodecamp.org/t/mongodb-and-mongoose-install-and-set-up-mongoose-problem/297907/11 "2021-01-17T09:33:23Z")

</div>


