Problem connecting to MongoDB Atlas with Compass


I’m trying to connect to my MongoDB atlas cluster with Compass.

This is my uri: mongodb+srv://

But after 10s trying to connect, I get the error: querySrv ETIMEOUT

I have found this solution on stack overflow (express - Can't connect to MongoDB Atlas (queryTxt ETIMEOUT) - Stack Overflow) wich worked for me, so here is my second uri that work for connecting via Compass : mongodb://,,

But now I want to connect via a nodejs application and I can’t make it work. I don’t really understand what I’m doing wrong. I tried on an other computer and I made it works easily with the first uri. Help?

Ps: All IP are whitelisted ( and my port 27017 is open (tryed on

It looks like a wrong password since the three nodes


are alive.

I have double checked my usernames and password. Also, the uri work in Compass but doesn’t work in nodejs environnement, so it’s not an authentufication problem

None of the URI is working for me.

However if I connect without a username and password. I can connect. So I keep thinking that the user name username or the password pswd are not correct.

I can also see that

is not the appropriate replica set name for this cluster. I do not see the full name but it starts with Boursogame- which is normal given the hosts are named boursogame-….

well yes I didn’t gave the real username in the forum, but here is the real username and password: mongodb+srv://

I didn’t know we could connect without username/pswd. But I can’t connect with or without the password ^^. This is really weird because on other computers I can connect. Here is my code:

const {MongoClient} = require(‘mongodb’);
const uri = “mongodb+srv://”;

async function Main(){
let client = new MongoClient(uri);
await client.connect().then(()=> console.log(“DB connected”));

client.connection.on('error', function(error) {
console.error('Database connection error:', error);



The only thing I can see is a firewall or VPN issues.

I was able to connect and authenticate.

I would suggest that you change the role of dbuser to be readAndWrite on the test database only.


I have tried deactivating windows firewall and avast. Also, I verified that my VPN wasn’t connected. I tried changing role of dbuser to read & write only but I still can’t connect to database

I have the exact same issue, checked my firewall and VPN and none of them are running.

Would really appreciate any additional help here. I’m working on an OSX machine.

@Sebastian_Alvarado Please start a new topic for your issue including relevant details of your environment such as the specific version of the driver/client you are trying to connect with and any error messages received.


Each time you troubleshoot, close and reopen Compass before trying.

Welcome to the MongoDB Community Forums @Raphael_Faluyi!

There is no need to close & reopen Compass if you are trying resolve connection issues. I recommend starting with the troubleshooting documentation for Compass Connection Errors, which includes some suggestions for both Self-Hosted Environments and Atlas Clusters. There are some also more general suggestions on Error: couldn't connect to server - #16 by Stennie.

Since this discussion topic is almost two years old and software versions have changed, I have also closed the topic.


1 Like