DEV Community

Joseph Louie
Joseph Louie

Posted on

How to set a database with MongoDB Atlas

What is MongoDB?

"MongoDB is a document database, which means it stores data in JSON-like documents." - Official MongoDB Website MongoDB is one of the most popular NoSQL databases.

What are the advantages of NoSQL?

  • Scalability: by default, non-relational databases are split (or "shared") across many systems instead of only one. This makes it easier to improve performance at a lower cost.
  • Flexibility: new datasets and properties can be added to a document without the need to make a new table for that data.
  • Replication: copies of the database run in parallel so if one goes down, one of the copies becomes the new primary data source. FreeCodeCamp

What is MongoDB Atlas?

MongoDB Atlas is a database hosted in the cloud. MongoDB Atlas handles all the complexity of deploying, managing, and healing your deployments on the cloud service provider of your choice (AWE, Azure, and GCP).

Steps to create a cluster on MongoDB Atlas

If this is your first time using MongoDB Atlas there probably be a button in the left-hand corner where you can follow the steps. If you've used MongoDB Atlas and have forgotten the steps here they are.

1a. Create a MongoDB Atlas account
1b. Under context, there is a dropdown where you can create a new project

  1. Create a new cluster
  2. You can keep everything as the default
  3. Create a new user on the Database
  4. You can find this in the Database Access
  5. Whitelist your IP address
  6. This can be find this in the Network Access
  7. Allow access from anywhere (0.0.0.0/0)
  8. Connect to your cluster
  9. Go back to your cluster and press connect
  10. Click on Connect your application
  11. You will use your URI to connect to your database
  12. It should look like this "mongodb+srv://:@.mongodb.net/test?retryWrites=true, notice that the user and cluster#-dbname"

Thank You for reading!
If you have any questions or something that looks off to you please feel free to comment. Tell me how you like MongoDB or MongoDB Atlas, I would love to hear your experience with it.

Top comments (0)