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 purposes 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.
Visit the above link and you will see a page like this :
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.
after clicking on the getting started button you will be redirected to this page.
Now check your inbox and verify your email address. after verifying you will see this page so click on continue.
Setup project on Atlas
Fill in all the information to get started. you can change this information later.
Then you will be asked to select an Atlas Type. I would suggest going with shared as it is free and for learning purposes.
Select any Cloud provider and Region as per your requirements.
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.
After some time you will get to see that your cluster is created.
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
After adding IP address and Database user click on the
choose a connection method button
Then click on the
Connect to your application option.
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 )
You can copy your connection string and put it on your application.
<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.
And that’s it for this topic. Thank you for reading.