Connecting to a MongoDB Database Using Robomongo

Chris Sevilleja
👁️ 62,862 views
💬 comments

Creating MEAN stack apps makes development incredibly fun. It seems like every part of the development process has tons of tools and is easy to use. Today we'll look at using Robomongo to connect to a remote mongo database.

In our case, we will be connecting to a database hosted by the good folks at Modulus.io. You can also use this to connect to a database at Mongolab.

Setting Up

First, make sure you have Robomongo downloaded and ready to go.

Table of Contents

    Second, let's go and create a database so that we have a connection URI that looks like:

    mongodb://<user>:<pass>@mongo.onmodulus.net:27017/uw15dfpu

    This will be the Mongo URI to connect to our database. We are passing in the username, password, database address, database name, and port. These will all be needed when setting up Robomongo.

    Connecting Using Robomongo

    Let's open up Robomongo and start up a new connection.

    mongodb-modulus-connect-with-robomongo

    We will only need to fill out two tabs here. The Connection and Authentication tabs.

    Connection

    This is where we will have a nickname for our database. We will also use the address and port.

    mongodb-modulus-connect-with-robomongo

    Authentication

    We will add in our database name, username and password here.

    mongodb-modulus-connect-with-robomongo-authentication

    Testing

    Once we have filled all that information out, test out your connection and rejoice!

    mongodb-modulus-connect-with-robomongo-authorized

    Using Your Database

    Once you are connected, you can see all the items in your database under Collections. Just like that, you have a nice GUI to maintain your Mongo database.

    mongodb-modulus-connect-with-robomongo-database

    Conclusion

    Connecting to a database from the likes of modulus.io or mongolab.com is very easy with Robomongo.

    There are also other options that Robomongo will let you use like a local database. It also provides support for SSH tunneling if you want to connect to your own server.

    Chris Sevilleja

    176 posts

    Founder of Scotch.io. Google Developer Expert in Web Technologies. Slapping the keyboard until something good happens.