Setting up the MongoDB Atlas Cloud Database

Let's learn how to sign up for MongoDB and create a cluster.

The fastest and easiest way to get started with MongoDB is by using its cloud service MongoDB Atlas to host a database on the cloud.

Note: Installation on your local machine is not required for this course. Everything can be done in the browser terminal.

Signing up for MongoDB Atlas

First, sign up for a MongoDB Atlas account and click “Create your Atlas account.”

Once you’ve signed up, go to the email account you provided and verify the email address.

After you’ve confirmed your email address, you’ll be redirected to the account page. Click “Build a Database.”

This prompts you to “Deploy a cloud database.” Select “Shared” for your cloud environment and click “Create.”

Creating a cluster

You’ll be taken to a “Build a New Cluster” page. Under “Cloud Provider & Region,” choose “AWS” as the cloud provider. AWS provides a free account without having to enter credit card details. Under “North America,” select “N. Virginia (us-east-1),” where you can get a free tier for your MongoDB.

Next, under "Cluster Tier," choose the "M0" free tier.

The good thing about Amazon AWS is that we can experiment without having to worry about making unintentional mistakes and getting a huge bill from Amazon. When your website becomes more popular and has more users, you can scale up at a later stage. Keep the other default options and select “Create Cluster.” It takes 7–10 minutes to set up everything on AWS.

Next, in the left panel under “Security,” click “Database Access.” There are currently no users. Create a database user by clicking “Add New Database User.”

Select an authentication method, and provide your new user with “Read and write to any database” privileges.

Next, under “Security/Network Access/IP Access List” select “Add IP Address” and choose “ALLOW ACCESS FROM ANYWHERE.” This allows the application to be accessible from anywhere on the internet.

We’ll revisit the MongoDB site later to retrieve the connection string to connect MongoDB and our Node.js backend.