MongoDB for Beginners: Setting Up Your Database with Atlas

codexive_zech

Zechariah Hounwanou

Posted on February 29, 2024

MongoDB for Beginners: Setting Up Your Database with Atlas

Imagine your data as fixed columns. Every data has to fit into its exact spot. Old-school databases lock you into a super strict way of storing your data. Scaling up a database was painful, expensive, and time-consuming. All these were some of the problems before the creation of MongoDB.

MongoDB is very powerful when used along with Node.js. It is open source and it also offers fast development and efficient performance for users. Nowadays everything has been moved to the cloud. We will learn about this cloud-based database called MongoDB.

As a developer embarking on your first MongoDB project, this article will be a guide that will equip you with the knowledge on how to create a MongoDB Atlas account and how to set up a MongoDB Atlas Cloud-Cluster that can be used in any Node.js project you are working on or planning to work on.

What is MongoDB?
MongoDB Atlas is a cloud-based service that allows you to easily set up, manage, and scale your MongoDB database. It was created in 2009. MongoDB Atlas Cluster is a managed NoSQL database service. With MongoDB Atlas, you can access, and manage your MongoDB database through the web interface, command-line tool, or directly from your application and deploy your database in multiple regions around the world for low latency and high availability.

When using MongoDB Atlas cluster you do not need to worry about the cloud service configurations, as it handles this for you under the hood without stress. There are paid options for the service but you can start with the Free Tier (which we are going to be starting with), and then scale up to a premium plan later on once your application needs increase.

Below are the steps involved in creating a MongoDB account and a MongoDB cluster that you can use for your project.

How to Create a MongoDB Atlas Account
Step 1: Open up your browser and type “mongodb” Google will provide you with sufficient results for your search but we are more concerned about the first website from the result page. Click on it will take you to the official website of MongoDB

google results

Step 2: After clicking on the link, you should be redirected to the official website of MongoDB. To create a MongoDB Atlas Account, you will need to click on the Try Free Button in the top right corner to create an account for free.

NOTE: No Credit Card info is required during account creation.

mongoDB landing page

Step 3: After clicking on the Try Free Button you will need to fill up your details in the Sign Up section or you can sign up utilizing your Google Account. I would recommend you take your time to fill in your appropriate information, acknowledge the Terms of Service and Privacy Policy, and then click on the button below to Create your Atlas Account.

MongoDB registration form

Step 4: MongoDB would like to verify the email address you registered with as soon as you create an account. So if you are seeing the screen below, you will need to head down to the mailbox associated with the email (you provided during registration) to verify your account by clicking the verification link in the email.

email verification

Step 5: After you have successfully created and verified your MongoDB Atlas Account, you will be redirected to the next screen below. Here MongoDB would like you to answer a few questions (like what project you will be building, the technology involved, etc.) so they can tailor your experience based on it. You shouldn't have to spend much time answering this.

anwsering project questions

After following through on the steps outlined above, your MongoDB Atlas Account is now ready for use without any hassle.

How to Create a MongoDB Atlas Cluster
Now we need to create our Cloud-Cluster which will allow us to deploy, scale, and manage our database without the need for setting up and maintaining our infrastructure.

Step 1: As a first step, we need to deploy the database we will be using for our project. From the available options, select the Free Tier (M0 Sandbox), which will provide you with limited resources ideal for development and testing purposes. Next, choose a Cloud Provider from AWS, Google Cloud, or Azure, and select the region closest to your location to ensure optimal performance. Provide a name for your cloud cluster, and then click on the Create button.

cluster creation

Step 2: Now that you have created the Free Cloud-Cluster that you will be using for your project, you will be redirected to this section and you will need to provide the username and password you will be using for the Cloud-Cluster you have just created.

Note: You need to use details you will be able to remember easily because during development you will need to include the username and password in your connection string so that your Node.js app can communicate with your cluster.

cluster credential creation

Step 3: After adding your cloud-cluster username and password, you will also need to connect your machine IP address to the cluster you have created. To add your IP address click on Add My Current IP Address and automatically it will pick and insert the IP address of your machine.

selecting IP address

After you have successfully done all of the above-outlined processes, you can click on the Overview on the sidebar and you will land on this page. You should see the name of the cluster you have created in the Database Deployment section.

succesful cluster setup

Congratulations! You have successfully created a free MongoDB Atlas account and Cloud-Cluster for your project. You can find more information on their official documentation.

💖 💪 🙅 🚩
codexive_zech
Zechariah Hounwanou

Posted on February 29, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related