Mongodb free hosting on mlab.

Charith Prasanna
5 min readAug 4, 2020

It would be much easier if we can host and work on our own database because in many projects, both mobile and web often have the same database. Then the mobile developer and web developer have the advantage of using a common database from the beginning. Connecting two databases at the end becomes more complicated and It is very difficult to make a differences.

Today we are going to see what is this mlab and how do we host our mongo database for free? mlab is a free hosting service that allows us to easily host mongo databases. This is the basic definition for mlab.

The first thing to do is do a Google search for mlab and go to the mlab website. Then we need to signup on their website. We need to fill out a small form like this when we go to sign up.

Enter the details correctly and create a new account.

Now you can see that we have received a small alert asking you to verify the email you gave. Now go to your mail inbox and click on the link in the email sent by mlab. (It will take some time).Now you can see that we have received a small alert asking you to verify the email you provided. Then go to your mail inbox and click on the link in the email sent by mlab. The link provides the following page.

You should Click the Create new+ button in the Mongo DB Development category at the top. then select the SANDBOX that I have circled here. After that click on the continue button below.

Next we have to the select our region, In this case firstly select US East and then click chosen region in bellow.

Now it’s time to enter the name of your database. Don’t forget to give in simple letters.

Press, submit order.Now the database you have created will be displayed in your Dashboard

Now select your dataset. The things I have underlined above will become important later. Currently we want to add a collection to our database. For that we can do it by clicking add collection on the left hand side.

Give a collection name and create.

Let’s enter the data into this collection.

Give Json Object .

Press create and back.( If an error occurs, it means that your document does not have the json object type)

After creating,

We need to create a user for this database.

Then ,

After creating,

Now let’s check if we can use this database. As soon as we run our project LochalHost, we can work with the hosted Mongo database. Before that. We need to check the connection in the database.

For this you can use an application called Robo 3T. (We also have to use mongocheaf, and the MongoDB Compass Community.) This Robo 3T application can be easily used for this purpose. Open the application and create a new connection,

And then, we need the things I emphasized earlier,

Give it a name of your choice

Then we need to look at Authentication.

In Authentication we have to give the database name we created (my name is exmpledb) , the database user name and the password we gave to that username.

Now click on the Test button. After that you will be able to use your database without any problems.

Now you have to give the link at the bottom of the previously underlined ones to the database connection point of your project.

Give the username you used in the database and the password for the two underlined ones. Now the work is done.

don’t forget to clap.I hope to see you guys with another article soon!

--

--

Charith Prasanna

Software Engineer | University Of Moratuwa | Intervest Software Technologies | Full Stack Developer