How to setup mongodb atlas?
Tags: mongodb, javascript, tutorial, cloud
Published: 2021-10-07 15:42:17

MongoDB is a NoSQL database and we can use MongoDB with different programming languages. MongoDB can be used locally or on Cloud. so in this article will discuss how to set up MongoDB on the cloud and connect with your application.

This is just for learning purpose so to get started will use the Free plan of MongoDB atlas. if you are planning to use MongoDB for production-level applications then you can upgrade the plan.


- Create an account on MongoDB atlas.
 
[click here](https://www.mongodb.com/cloud/atlas/register)

Visit the above link and you will see a page like this :


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633256242504/Pv9Jx3y3A.png)

You can just fill up all the information and click on the `get started free` button.


> Please fill in the proper email id to get a verification email.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633256420709/mjKlFRzIY.png)

after clicking on the getting started button you will be redirected to this page.


![screenshot.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633256870619/j70FRLZp2.png)

Now check your inbox and verify your email address. after verifying you will see this page so click on continue.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633257060884/_J-wkBClE.png)

- Setup project on Atlas

Fill in all the information to get started. you can change this information later.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633257242947/Mia1uv42s.png)

Then you will be asked to select an Atlas Type. I would suggest going with shared as it is free and for learning purposes.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633257444592/Gsi7tmz56.png)

Select any Cloud provider and Region as per your requirements.


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633257774688/bCqQdA2U0.png)

Click on create a cluster button and you will be redirected to a page like this where it will show Your cluster is being created. so please wait for some time.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633257942165/-HsWYcQ9f.png)

After some time you will get to see that your cluster is created.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633258167409/PX69sJHxK.png)

Now click on the `Connect` button and Modal will be open like this. here you have to do two things

- Add Your IP address ( so that you can access this cluster in your application )
- Create a Database user 


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633258272836/Nsr86wFfj.png)


![screenshot (1).png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633258748445/KlpjdeRV6.png)

After adding IP address and Database user click on the `choose a connection method` button


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633258874150/nYThOpaF4.png)

Then click on the `Connect to your application` option.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633258952465/L_eff0Ylg.png)

Here you will see two things:
- Drivers and version ( you can select any driver and version, I have selected python and the latest version )
- connection string ( your connection string will be different from my connection string )


![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1633259296394/dzHmYah24.png)

You can copy your connection string and put it on your application.

> Replace `<password>` placeholder with your actual password.

I hope you would have found this article helpful. if you have any queries you can ask in the comment section I would be happy to help you out.

Thank you for Reading.