How To Create a Free Cluster in MongoDB | MERN Stack

How To Create a Free Cluster in MongoDB | MERN Stack

                MongoDB is a No-SQL database that also provides a free tier by which you can set up databases for personal uses like web applications etc, Let's see in detail the steps to make a free cluster in MongoDB


                In the Last Article, we read about the MERN stack and what additional features it has compared to traditional web-development methods, and MongoDB is one of the main technologies used in it.


Steps In Getting A Free MongoDB Cluster

                MongoDB provides a free cluster that will be fully managed by it, we can custom changes to it like the deployment and service providers like AWS, Azure or Google Cloud, etc. In addition, we can also customize the size and storage of the database. All the management and system establishments will be taken care of by MongoDB we can just connect to the database using different methods and start the interactions using queries.

  •  First Goto MongoDB Atlast Website and log in using one of the given methods:


After logging in using a google account or email, you will be redirected to the Privacy and Policies page, click on I accept the terms, and click on submit. After this your account will be created in MongoDB, sometimes it might take 20-30sec so be patient.

  •  Next, you need to set up the MongoDB Atlas cluster and its configurations most of them are default.

Here you need to Select Build a New Application, and the type of application you're using DB for, Select the Language used to develop the application, in this case as we are developing the MERN app, Javascript needs to be selected, if you're using Django you can select Python and etc.



  • The next step is deploying the database in a cloud, there are 3 different types of deployment here.
Serverless: - This is best for Variable traffic and scalable database management systems, this works on the basics of Pay as you go principles, you can terminate the instances which not used and run instances when needed.

Dedicated:-  This Type of deployment provides greater isolations and is used for complex applications, which require dedicated instances. Serverless deployment costs are higher than dedicated deployment and in this, there is only a fixed no of instances running at all times.

Shared:- This is a like sample deployment which is used for learning MongoDB, there is no need to enter credit or any card details you can directly start a cluster using these options, this is the free tier which is provided by MongoDB you need to select this option.

Select Shared deployment and click on Create button.




  • In this step, you need to select the service providers and the region you want to deploy the instance.

                It is always preferred to choose a location which is near your country or else the data interactions process may take a lot of time due to latency. You can also select other configurations like Main Memory and Secondary Memory, Name Cluster you can name your cluster as you wish.


                For most of the Configurations, you can leave it to default as the free tier doesn't give many functionalities, and is only used for learning purposes. After naming the cluster and selecting a region click on create a cluster.



You can skip the Email and other settings and go to the home page of Atlas.

Now when you click on a database on the left dashboard you can see that your cluster is being created with the specified configurations, It will usually take around 2-3 minutes, so be patient. 


                Now Connecting to the Application is left to do, For this, we need to create a user for the cluster, click on connect button which allows you to create a user with username and password, and click on create Database user, after this click on Choose connection Method. You need to click on Add Your Current IP address before going to the next tab.



In the Connection Method, there are 3 Different options, Using a Shell, Using an Application, and Using a MongoDB compass which is a GUI application. As we are developing a Web Application Select Application. On the Next Page, you can see that it has generated a Code in the preferred Language which we will be using in our App.


The point to be noted here is that in the code you need to keep your Database user details, in this case, the user is a "cluster user" for you the username might be different and the <password> should be replaced with the password for the user. 

So In this way, We can create a MongoDB cluster for a Web Application Later on we shall see how to use the Mongoose library for interacting with the database and writing queries in MERN Stack.

Hope the article was useful, Thanks For Reading.

Post a Comment

Previous Post Next Post