Intro to MongoDB Atlas

Steven Wu
4 min readAug 22, 2021

As some of you may know I’ve been building MERN app and I’ve been really enjoying Mongo Atlas as a developer and today I will get into What Atlas is and how you can start using it.

Mongo Atlas came out in 2016 and it gave us an effortless way of storing our Mongo Database in the cloud, rather than the traditional option of running a Database server on your own hardware, Mongo Atlas can also be run on a hybrid system where your Database is stored in the cloud and your own environment machine. One main factor of why I’m using Mongo Atlas is the flexibility on their system, price and accessibility.

How to

First you would need a MongoDb account. Here’s the register page of Mongo Atlas, you can log in through the portal on the top right if you already have an Mongo account.

After you log in the web UI will prompt you for some meta data, you can always skip for now.

Next step would be choosing what kind of DB cluster you want to create. I would start with the free option of a shared DB so we can learn the system first without having to spend a dime.

Next up is your choice for a cloud provider, default option is AWS but I went with Azure just because I’m a Microsoft fan boy.

Next up is the cluster size options.

The basic free option comes with 512MB of storage and a maximum of 500 connections, which in my opinion is quite enough for a starter app. You can easily change this in the provided Atlas cloud manager.

The free cluster option does not include any backup options. You will have a daily backup on your cluster if you choose any of the paid options for storage.

Below the additional settings is a text-field to input your cluster name. Just keep in mind that the Cluster name can’t be changed after creation, so choose your name wisely.

After a few minutes, your cluster will be created and the next step would be connecting to your db

Click connect and it prompt you for some security settings

For security purposes, you should only add IP access from your environments.

Make sure you remember this password for a user access account since this is how you will connect with your cluster on your code. If you forget your user and password, you can always go to the cloud manager to add new privileges.

Next you have a few options on ho you want to connect to your DB. The Connect your application option is what I will be using today

I’m currently using a Node Express server but you can select other drivers for other languages and frameworks.

Mongo Atlas provides you with all the boilerplate code if you click the “Include Full Driver Sample” and just hit the copy button and you can paste it into your server code.

Just keep in mind the code sample will generate the username you created before but it does not provide your password for security reason. Make sure you replace the <password> placeholder with your actual password in order for this to work.

That’s it! You’re connected to your Mongo Atlas cluster. This is quite a lengthy subject so I will be writing a Pt.2 to the Mongo Atlas guide sometime next week and we will explore how you can set up CRUD functions and search your DB as well, stay tuned for that and in the meantime here’s a Mongo cheatsheet for any built-in Mongo methods you want to try for now.

Thank you for reading and please leave a comment if you‘ve enjoyed and follow for more coding and tech content.

--

--