can integrate various data sources. One of the services it can integrate with is mLab, a MongoDB-as-a-service. This post will demonstrate how to connect them together and enjoy the advantage of working with MongoDB and Hadoop on the cloud.

MongoLab Settings

  1. Sign in into your mLab account or sign up if you don’t have one.

  2. Click the relevant DB in the dashboard. If you don’t have a DB, you can create a free sandbox by clicking Create New, Single-node (development), and choosing the Sandbox plan. For more details, please see mLab’s documentation.

  3. Create a collection for the DB if one isn’t available by clicking the Add Collection button.

    thumbnail image

  4. A database user must be added. If there is no user, a yellow message will appear with a link to create one. Click it and follow the instructions. Keep a note with the database username and password on the side (note - they may be different than the username and password for the entire MongoLab account).

  5. Back on the database screen, look for the line “To connect using a driver via the standard URI”. Check the line that appears below it and note down the host and port number. E.g., if the URI displayed is mongodb://<dbuser>:<dbpassword>, then the host is and the port number is 45557.

  6. If you need to migrate data into your MongoLab database, please refer to the documentation. Settings

  1. Login to your account. If you don’t have one, create a free account.

  2. In your account, click the user image on the top right and choose Account settings.

  3. Click the Connections menu on the left, click New Database Connection, and choose MongoDB.

    thumbnail image

  4. Enter any name that you want for the connection, and then insert the relevant MongoLab database details. Note that the username and password are for the specific database which you are trying to access, not the MongoLab account. Also make sure to disable the “Connect using SSL” checkbox since it isn’t supported for a MongoLab connection.

  5. Click the Test Connection button at the bottom to make sure the connection works. If it fails, one of the details that you entered is incorrect. Go back to the MongoLab Settings section and make sure all the details are accurate.

  6. Click the Create MongoDB Connection button.

  7. Open an existing package or create a new one via My Packages, New Package.

  8. Click the New Source button at the top and choose MongoDB.
    thumbnail image

  9. Click the component that was just added. The MongoDB Source dialog should appear. Choose the MongoDB connection that you previously created in the MongoDB Connection dropdown, and click the green auto-detect schema button on the right. The schema should be filled automatically. Also make sure to enter the source collection name. For more info how to work with MongoDB source components, please refer to the help section.

  10. Back on the package screen, add components to process the data as necessary.

  11. To save the processed data back on mLab, add a MongoDB destination. Click the component to open the edit dialog. Choose the relevant MongoDB connection and enter the target collection.

All done! To run the job, you will need to setup a cluster. Please refer to the documentation for further details.

Read more about the power of data integration on the blog.