Introduction
MongoDB is one of the most popular NoSQL databases. It is being used to store the data in a document format where this document resembles a JSON object. Heroku is a cloud platform that is extensively used to develop and deploy web apps in various languages. So learning how to connect Heroku with MongoDB becomes important.

In this blog, we will deploy an application on the Heroku platform with a MongoDB database. So let’s get started!
Set up MongoDB Atlas
Follow the given steps properly to set up your MongoDB Atlas account.
Sign-up Process
Step 1: Create an Atlas account. Navigate to the MongoDB atlas sign-up page and create your account. If you already have an account, then you can click on the Sign In option.

Step 2: Here you can sign-up either using your email id or your Google account. Fill in all the required fields properly and check the privacy policy and click on Get started free.
Step 3: Once you verified your email address, you are done creating your account. Next, head back to the login page and log in to your account.
If you are a first-time user of this platform, you will be given the ‘Welcome to Atlas’ page.

Step 4: Choose the options according to your requirement and click on the Finish button.
Create a Database
Step 5: Now, you will be taken to create a database to start using MongoDB Atlas.
You can choose the Auto Setup field, which will automatically do your Atlas setup, or you can opt for the Manual field, where you can configure your deployment manually with some advanced configuration options.

Step 6: Here, we will choose the I’ll do this later option and then add a new database user from scratch.
Add New Database User
Follow the below steps correctly to add a new database user:
Step 7: On the left-hand navigation menu, click on the Database Access link to which the below image will pop up.

Step 8: Fill out the complete form with the given steps:
-
First, in order to authenticate your database user, you need to authenticate your system.
-
Add your username and unique password. Make sure to add a strong password that you’ll remember. You can even autogenerate your password.
- Now, under the Built-in Role section, select one built-in role for the user.

-
Select the Atlas admin option.
Note: Do not check the Temporary User option. It would make your user a temporary user, which will be deleted after the specified time.
Step 9: Whenever you are done, click on Add User button.
Add an IP Address
Follow the below steps to allow your IP address:
Step 10: On the left-hand menu, navigate and click on the ‘Network Access’ link.

Step 11: Click on ALLOW ACCESS FROM ANYWHERE, which will set the value to 0.0.0.0/0.
Step 12: Click on Confirm button.
Congratulations! You have successfully set up your first Atlas cluster.









