March 12, 2019 By Phil Alger 4 min read

Using Robo3T to connect to IBM Cloud Databases for MongoDB

We have a lot of customers who enjoy using their favorite database management tools and want to use them to manage their databases in the cloud. In this article, we’ll show you how to connect to IBM Cloud Databases for MongoDB using Robo3T (formerly Robomongo), a popular GUI for managing your MongoDB deployments.

Robo3T (formerly Robomongo) is a great GUI for managing and querying MongoDB. We’ve been getting a lot of questions about how to connect to IBM Cloud Databases for MongoDB using the tool so we’re going to show you an easy way.

We’ll start off by provisioning a Databases for MongoDB deployment and then create the credentials that we’ll use to connect to Robo3T. After that, we’ll use those credentials to set up a connection using Robo3T’s GUI interface to make a successful connection to your MongoDB deployment.

Creating the Databases for MongoDB deployment

In this example, we’ll provision a Databases for MongoDB deployment using the IBM Cloud CLI. To create a database, you’ll need to log in first. If you’re using a federated identity, you’ll use:

ibmcloud login --sso

After logging in, create the database with:

ibmcloud resource service-instance-create <your_db_name> databases-for-mongodb standard us-south

For example:

ibmcloud resource service-instance-create ICD-MongoDB databases-for-mongodb standard us-south

Getting the Database credentials

Once the database is done provisioning, you can get the credentials using the cloud-databases plugin. Install that using the following command:

ibmcloud plugin install cloud-databases

Now you’ll be able to access your database credentials with the ibmcloud cdb command. Using that command, let’s get your Databases for MongoDB credentials:

ibmcloud cdb cxn ICD-MongoDB

This will show you your connection strings like this:

MongoDB   mongodb://admin:$PASSWORD@aaa-aaa-aaa-aaa-aaa-0.aaa.databases.appdomain.cloud:32508/ibmclouddb?authSource=admin
                  mongodb://admin:$PASSWORD@aaa-aaa-aaa-aaa-aaa-1.aaaa.databases.appdomain.cloud:32508/ibmclouddb?authSource=admin
CLI             mongo -u admin -p $PASSWORD --ssl --sslCAFile aaa-aaa-aaa-aaa-aaa 
--authenticationDatabase admin --host replset/aaa-aaa-aaa-aaa-aaa-0.aaa.databases.appdomain.cloud:32508,aaa-aaa-aaa-aaa-aaa-1.aaa.databases.appdomain.cloud:32508

You’ll need both connection strings that start with mongodb://... to make a successful connection as a replica set. We only need the host names and the ports. Note that the replica set name is replset, which is the case for all Databases for MongoDB connections.

The next step is to set the admin password. We’ll set the admin password to mypassword for this example:

ibmcloud cdb deployment-user-password ICD-MongoDB admin mypassword

You’ll also need to decode the CA certificate that your databases need for authentication. To decode it, run the following command then make sure to copy the decoded certificate and save it to a file on your system:

ibmcloud cdb cacert ICD-MongoDB 

Connecting to Robo3T

You can now use your credentials to connect to Robo3T. When you start Robo3T, you’ll be presented with a screen to create a connection. Click on the Create button at the top-left corner.

A window will pop with a few tabs that you will need to add your credentials to so that you can log in. The first is the Connection tab. For Type, you need to select “Replica Set.” You can provide any Name you want for the connection. Next, for Members, you’ll need to add your Databases for MongoDB hosts with their ports that you got earlier. The Set Name should be replset, as I mentioned above.

Now, click on the Authentication tab. Here, you’ll need to click on the Perform authentication box. The Database you’ll authenticate to is “admin.” Then, insert your admin username and password in the boxes below that. Keep the Auth mechanism set to the default.

The final step is to click on the SSL tab. Click on the Use SSL protocol box. Then, click on the box  next to CA Certificate. Select the file that contains your decoded and saved CA certificate.

To check to see if your connection is successful, click on the Authentication tab again, and at the bottom of that window, you’ll see the Test button. Click that button and you’ll see a pop-up window appear indicating that Robo3T is trying to connect. If it’s successful, you’ll receive two green check marks that you’re “Authorized on admin database as admin.” Once that’s done, click Save at the bottom of the window.

This will take you back to the main screen where you set up the connection.

Now, click on Connect at the bottom of that screen and you will see your Databases for MongoDB collections appear on the left side of the Robo3T tool.

Start using Databases for MongoDB

Provisioning a Databases for MongoDB deployment, getting the credentials, and making a successful connection to Robo3T is straightforward and easy to do. All you need to do now is start using your database.

Was this article helpful?
YesNo

More from Cloud

How a US bank modernized its mainframe applications with IBM Consulting and Microsoft Azure

9 min read - As organizations strive to stay ahead of the curve in today's fast-paced digital landscape, mainframe application modernization has emerged as a critical component of any digital transformation strategy. In this blog, we'll discuss the example of a US bank which embarked on a journey to modernize its mainframe applications. This strategic project has helped it to transform into a more modern, flexible and agile business. In looking at the ways in which it approached the problem, you’ll gain insights into…

The power of the mainframe and cloud-native applications 

4 min read - Mainframe modernization refers to the process of transforming legacy mainframe systems, applications and infrastructure to align with modern technology and business standards. This process unlocks the power of mainframe systems, enabling organizations to use their existing investments in mainframe technology and capitalize on the benefits of modernization. By modernizing mainframe systems, organizations can improve agility, increase efficiency, reduce costs, and enhance customer experience.  Mainframe modernization empowers organizations to harness the latest technologies and tools, such as cloud computing, artificial intelligence,…

Modernize your mainframe applications with Azure

4 min read - Mainframes continue to play a vital role in many businesses' core operations. According to new research from IBM's Institute for Business Value, a significant 7 out of 10 IT executives believe that mainframe-based applications are crucial to their business and technology strategies. However, the rapid pace of digital transformation is forcing companies to modernize across their IT landscape, and as the pace of innovation continuously accelerates, organizations must react and adapt to these changes or risk being left behind. Mainframe…

IBM Newsletters

Get our newsletters and topic updates that deliver the latest thought leadership and insights on emerging trends.
Subscribe now More newsletters