I am not able to connect with mongodb atlas using mongoose.connect

Viewed 55

I am trying to build a website for my college hence I chose mongodb as my database using NodeJS . It worked great in my local machine and on the Heroku. But now I am deploying it on the cPanel there is one issue that I am not able to connect to mongodb atlas and hence not able to get the data. From error logs I think the problem is with mongoose connect() but I am not sure. May be problem can be different also. I am attaching error logs and mongoose code from app.js file for better understanding of the problem. Please can you help in this.

mongoose.connect("mongodb+srv://usernmae:password@cluster0.1laezrl.mongodb.net/Yearbook10",
    {
      useNewUrlParser: true,
      useUnifiedTopology:true
    }
    ).then(()=>{
      console.log("Connected with the db")
    })

Nodejs in cPanel [1]: https://i.stack.imgur.com/RRdtb.jpg

0 Answers
Related