I am trying set up a connection with mongo-atlas but its throwing a connection error
Here is my code:
const mongoose = require('mongoose')
const connectionString = 'mongodb+srv://<username>:<password>@nodeexpressproject1.euk9ons.mongodb.net/?retryWrites=true&w=majority'
mongoose
.connect(connectionString)
.then(() => console.log('Connected to the DB.....'))
.catch((err) => console.log(err))
<username and <password are my username and password, respectively.
The error shown is:
MongoNetworkError: failed to connect to server [ac-i4mxecj-shard-00-00.euk9ons.mongodb.net:27017] on first connect [MongoError: bad auth : authentication failed
I have tried basic troubleshooting such as checking IP address
I have checked the following question and no solution works for me Error at connecting to MongoDb Atlas Server
Please note that I don't have any special characters in my password