I have created a cluster and would like to access it with MongoDB Compass.
Via Connect
-> I have MongoDB Compass
I get the following connection string:
mongodb+srv://myname:<password>@myname.nauqp.mongodb.net/dws
When I enter this string in MongoDB Compass and insert my password and replace test
with the name of my DB, the connect button is disabled and the following error message below it:
querySrv ENOTFOUND _mongodb._tcp.myname.nauqp.mongodb.net
I also have the same problem when I want to establish the connection via mongoose. There I get the error message:
Error: querySrv ENOTFOUND _mongodb._tcp.myname.nauqp.mongodb.net
[nodemon] app crashed - waiting for file changes before starting ...
My config looks like this:
const connectDB = async () => {
try {
const connection = await mongoose.connect(process.env.MONGO_URI, {
useUnifiedTopology: true,
useNewUrlParser: true,
useCreateIndex: true,
})
} catch (error) {
// error handling
}
}
The MONGO_URI in my .env file looks like this:
mongodb+srv://myname:<password>@myname.nauqp.mongodb.net/dws?retryWrites=true&w=majority
MongoDB Compass Version: 1.22.1 (1.22.1)
Node Version: v14.15.0
What am I doing wrong?