Re: mongoose.connect(), first argument should be String, received undefined.

14 views
Skip to first unread message
Message has been deleted

itxBornFire

unread,
Jan 17, 2019, 2:25:55 AM1/17/19
to Mongoose Node.JS ODM
what is the value of your process.env.MONGO??? 

process.env.MONGO = "...";  //it should be a string, trying hard coding it. Something similar to the code line below

mongoose
.connect(
process.env.MONGO || "someUrlHere", {...mongooseOptions});





On Thursday, 17 January 2019 09:13:43 UTC+2, Jacob Smith wrote:

console.png



I am trying to connect to my database, but it is not allowing me to do so because for some reason it throws the error above.

Here is my code up to where I try and connect:

code.pngI don't see what's wrong with my code. Please help.P.S. Yes, dotenv is working. I did a test earlier where I instantly logged one of my API keys and it worked. Also, Sentry connects.

Reply all
Reply to author
Forward
Message has been deleted
0 new messages