Using MongoDB as a Service: mLab

While you can install your own instance on your computer, there services which offer database as a service. In this part of tutorial, you will learn how to use mLab.

  1. Register on https://mlab.com/
  2. Login into your account and clieck on “Create New”
  3. Choose a free plan by clicking on “SANDBOX”, and then click on “continue”
  4. Select a Region and then click on “continue”
  5. Type your database name and click on “continue”
  6. Submit your order
  7. Click on your database to open it
  8. Click on the “Users” tab and to create a new user for your database
    As you see in the below picture, there is connection string that you need to copy and use it later to connect your remote DB


  9. Now you can connect to the database using the user your created and the following connection string:
    connect( host='mongodb://<YOUR_USERNAME>:<YOUR_PASSWORD>@<DS_NUMBER>.mlab.com:<PORT_NUMBER>/<YOUR_DATABASE_NAME>' ) 
    Be noted that you need to replace the variable in the above string using your username and password, and the string provided in the previous step.

Resource created Friday 03 August 2018, 03:08:03 PM, last modified Monday 24 February 2020, 03:07:53 PM.


Back to top

COMP9321 18s2 (Data Services Engineering) is powered by WebCMS3
CRICOS Provider No. 00098G