Inability to connect IBM Cloud to Mongodb host


I was trying to connect my IBM Cloud Project to my MongoDB cluster but wasn’t able to do so. But when I tried to connect to host “” , which is created for the mongodb university(training purpose), I was able to connect. Basically any IBM Cloud isn’t able to connect to host that I created but my IBM Cloud instance was able to connect to the one that is setup by you guys. I was wondering the issue could be the different ways the host are set up(configured) but could not pinpoint what exactly it is that is making the difference?

Welcome to the community @Harpreet_Kaur!

If you have created a new self-hosted MongoDB installation, it will only be listening to localhost by default. If your IBM Cloud application is running on a different instance from the one where you have installed MongoDB, you will need to set up appropriate firewall and security access.

Please review the MongoDB Security Checklist for your version of MongoDB server. In particular, you will want to configure access control, network encryption (TLS/SSL), and firewall access to limit exposure to your MongoDB instance.

If you are still having difficulty, please provide more information including:

  • your specific O/S version
  • version of MongoDB installed
  • what you have tried and any relevant error/log messages
  • version of the application or driver you are using to connect

I recommend using the mongo shell to test connectivity to your MongoDB deployment before trying to set up a driver connection.


Thanks Stennie for your response. Lets ignore the IBM for a minute. I have not been able to connect to one of the hosts within the replica set using the mongo shell. Although I am able to connect to the entire replica set using the mongo+srv record using the shell. Also I have been able to connect to individual host using the same credentials through compass. I feel if I am able to resolve this then I will be able to fix the IBM thing.


If you are able to connect by Compass to single node sameway you can connect by shell
What command you used for Compass?
I can connect to individual nodes of Class cluster(jxeqq) using shell

MongoDB Enterprise Cluster0-shard-0:PRIMARY> exit
MongoDB Enterprise Cluster0-shard-0:SECONDARY> exit