Can't connect my nodeJS project to the mongodb atlas cluster

Hello everyone!

Hopefully I’m in the right place to ask my question :slight_smile:

So I’m trying to resolve a problem for a while now but couldn’t find much that helped me on the internet.
So the problem is that I can’t connect to my Mongodb atlas using my cluster, it used to work very well before.

Here is the error I receive :

I have an “ECONNREFUSED” to a specific IP.

What I understood is that I’m trying to connect to my cluster through a different IP each time ( Dynamic IP changing from Mongo db I believe )

I’m using O2switch as my server ( Cpanel ) and I feel that I need to allow the IP that I’m connecting to which makes it work somehow, but then the IP change again and I can’t connect anymore.

I thought of allowing a MongoDB cluster DNS resolver on my Cpanel to be able to connect even if the IP changes but without success until now.

For your information as well if needed, I allowed all IPs to access my cluster, my password and username are correct in my cluster as well.

Hope I was clear enough, I’m still a junior trying to figure it out things :slight_smile:

Thank you !

Hello @Takayuki_Wada ,

Welcome to The MongoDB Community Forums! :wave:

Could you share additional details for me to understand your use-case better?

  • Could you please try connecting to your Atlas cluster via Mongo Shell or Compass?
  • Can you share your connection string? (Kindly Redact any username/password from this)
  • Any active firewall that might be blocking access?
  • Can you please confirm if your IP address is whitelisted in the Atlas?
  • What is your Atlas deployment type?
  • Kindly check Atlas Cluster connection graph of the cluster you are trying to connect with as different Atlas tiers have different connection limits; clusters of size M0/M2/M5 , for example, are limited to 500 connections, and clusters of size M10 are limited to 1500 connections.

Attaching a few documents you can refer to troubleshoot/fix connection error.

Regards,
Tarun