Getting Started with MongoDB Atlas: Overview and Tutorial

Blog 1 Title Image

Introduction

Database-as-a-Service

In recent years, the database industry has undergone a number of changes, resulting in an increased shift towards a database as a service (DBaas) model versus an on-premise infrastructure. Databases are at the core of most business apps, and cloud-based DBaaS services offers users a flexible, scalable, and on-demand platform that eliminates the need to set up costly physical hardware, install software, or configure for performance. In addition, the data companies are analyzing is also changing. Users and developers now look for more adaptable databases that allow them to access and work with unstructured data. Along with this has come a greater demand for in-memory and NoSQL databases with a pay-per-use model. 

MongoDB, the company behind the open source database, sought to fill this need with Atlas, its own DBaaS offering that provides users with a managed database service. The service offers pay-as-you go pricing and allows users to deploy on the cloud service provider of their choice (AWS, Azure, and GCP). Atlas has been a success for MongoDB, and as of 2019 accounts for 35% of its total revenue with over 12,000 customers. 

In this post, we’ll provide an overview of MongoDB Atlas, give a tutorial on getting started with the platform, and share our general takeaways from a first-time user perspective. 

MongoDB Atlas

Overview

MongoDB Atlas is a cloud-based, open-source, NoSQL database that uses JSON documents with dynamic schemas, serving as an alternative to table databases. Atlas provides all the features of MongoDB, while automating database administration tasks such as database configuration, infrastructure provisioning, patches, scaling events, backups, and more, freeing up developers to focus on what matters to them most.

MongoDB Atlas also provides the dual benefit of flexibility and scalability. Dynamic schemas allow users to change the schema of their data without modifying it, providing flexibility. While its “automatic sharding” feature allows users to scale up or out across a range of instances, with zero application downtime.

Pricing

Free Tier

MongoDB offers a free tier that users can use for learning, prototyping, and early deployment. This free edition called M0 Sandbox is limited to 512MB of storage, shared vCPU and RAM, 100 max connections, and a limit of one M0 cluster.

Paid Tiers

Atlas paid plans for single-region clusters start at  $0.08/hr at an estimated cost $56.94/month.

For dedicated clusters, MongoDB Atlas is billed hourly based on how much you use. The rate depends on a number of factors, most importantly, the size and number of servers you use. According to MongoDB for example, an AWS 3-node replica set of M40s ran 24/7 for one month using the included 80GB of standard block storage would cost around $947. 

Getting Started with MongoDB Atlas

MongoDB Atlas makes it easy to get started and registering for the free tier takes only seconds. The whole process uses a dynamic web interface that walks you through various deployment options. It’s easy, intuitive and doesn’t require specialized knowledge. Below, we’ll go through the steps of getting up and running with MongoDB Atlas.

Creating an Atlas Account

First, you’ll need to register for an account on the MongoDB Atlas landing page. The registration form only needs you to provide basic information like name, email, company and for you to create a password. No credit card info is required. Once you register, Atlas automatically creates a default organization and project where you can deploy your first cluster.

MongoDB Atlas Landing Page (Source - mongodb.com)
MongoDB Atlas Landing Page (Source – mongodb.com)

Deploy a Free Tier Cluster

After logging in, you’ll be prompted to build your first cluster by choosing a cloud provider and region. Atlas works with the three primary cloud providers Amazon AWS, Google Cloud, and Microsoft Azure. Based on your choice, you can pick the location of the preferred data center location. Free tiers and regions are flagged for the free sandbox version and creating a new cluster took only a few minutes. 

Choose a MongoDB Atlas Cluster and Cloud Provider (Source - mongodb.com)
Choose a MongoDB Atlas Cluster and Cloud Provider (Source – mongodb.com)

Whitelist Your Connection IP Address

You will then be prompted to set up your Internet Protocol (IP) and whitelist your IP address. This is important, as it ensures that only you can access the cluster in the cloud from your IP address. You also have the option of allowing access from anywhere, though this means that anyone can have network access to your cluster. This is a potential security risk if your password and other credentials leak.

MongoDB Atlas Whitelist IP Address Prompt  (Source - mongodb.com)
MongoDB Atlas Whitelist IP Address Prompt  (Source – mongodb.com)

Create a MongoDB User for Your Cluster

Next, you’ll need to create a MongoDB user to access your cluster. Simply enter the new username and password. You’ll then have the option of selecting user privileges, including admin, read/write access, or read-only access. 

Create a MongoDB Atlas User Prompt  (Source - mongodb.com)
Create a MongoDB Atlas User Prompt  (Source – mongodb.com)

Connect to Your Cluster

Now that you’ve created a user, it’s time to connect to your cluster. You’ll be prompted to select a connection method, either connecting with MongoShell, your own application, or MongoDB Compass, MongoDB’s GUI. In this example, we’ll connect using MongoDB Compass.

Connecting to MongoDB Atlas Cluster Prompt  (Source - mongodb.com)
Connecting to MongoDB Atlas Cluster Prompt  (Source – mongodb.com)

Once you’ve downloaded and opened MongoDB Compass, you’ll be prompted to paste a connection string from your clipboard, then connect to your cluster.

Paste Connection String to MongoDB Atlas Cluster  (Source - mongodb.com)
Paste Connection String to MongoDB Atlas Cluster  (Source – mongodb.com)

Insert and View Data in Your Cluster

Now that you’re connected to your cluster, you can now insert and interact with sample data on your cluster using Data Explorer. 

Data Explorer allows you to view, create, and drop databases, collections, and indexes in your cluster. In addition, you can insert, edit, and delete documents, as well as create and run aggregation pipelines to process your data. Note that Data Explorer is a feature within Atlas that allows you to access and manage data inside your clusters, different from MongoDB Compass, a stand-alone GUI used to interact with MongoDB databases (we’ll discuss this further in Part 2 of this post). 

First, you’ll need to load the sample data set into your cluster. Once loaded, you can access it in Data Explorer by clicking the Collections button (or with Mongo Shell). The data import takes approximately 5 mins and once the operation finishes, you will see five databases in your cluster:

  • sample_airbnb
  • sample_geospatial
  • sample_mflix
  • sample_training
  • Sample_weatherdata
Loading Sample Data to MongoDB Atlas Cluster  (Source - mongodb.com)
Loading Sample Data to MongoDB Atlas Cluster  (Source – mongodb.com)

Now that you have imported data into your cluster, you can now view and modify them. You can also use Data Explorer’s Filter bar to search for specific documents, edit documents (i.e. add fields), then save your updates.

View and Modify Data In Your MongoDB Atlas Cluster with Data Explorer (Source - mongodb.com)
View and Modify Data In Your MongoDB Atlas Cluster with Data Explorer (Source – mongodb.com)

And just like that, we have gone through the entire process of registering for an Atlas account, deployed and connected to your first Atlas cluster, populated your cluster with sample data, and interacted with the data using Atlas Data Explorer. As you can see, getting started with Atlas was delightfully simple and straightforward. 

Summary

Overall, we found MongoDB Atlas to be easy to use and get acclimated to. The process of registering for an account, deploying your first cluster, and connecting to your cluster was seamless thanks in large part to its intuitive interface. In particular, we liked that Atlas included sample data that we were able to load into our cluster and then utilize the Data Explorer GUI to interact with the data. 

Its simple user interface, along with its host of features including scalability with automatic sharding, built-in automation mechanisms for operational tasks, and excellent performance that provides high throughput and low latency even for the most demanding workloads, and it’s no wonder that experienced developers and new users alike have grown to love MongoDB Atlas.

In Part 2 of this post, we’ll continue where we left off and delve deeper into visualization solutions for your MongDB data including Mongo’s GUI tools like MongoDB Compass, industry standard BI tools, and native solutions like MongoDB Charts – Mongo’s own charting tool that allows you to create visual representations of your MongoDB data stored in MongoDB Atlas. We will also be introducing Knowi for MongoDB analytics. Knowi is an analytics platform purpose-built for modern data stacks for more advanced data analytics and visualization. 

Takeaways

  • Cloud-based DBaaS are flexible, scalable, on-demand, and eliminates the need for costly physical set up
  • MongoDB Atlas is MongoDB’s own cloud-based, open-source, NoSQL-based fully managed DBaaS offering
  • Atlas automates database administration tasks such as configuration, infrastructure provisioning, patches, scaling events, backups, and more
  • Atlas provides flexibility with dynamic schemas while the automatic sharding feature make it easy to scale up and out across instances
  • An intuitive interface makes it easy to get started with Atlas. Deploying and connecting your first cluster takes only a few minutes
  • Data Explorer is a useful feature that allows you to visually interact with data in your cluster
  • Its simple user interface, task automation, flexibility, built-in replication, and on-demand pricing makes MongoDB Atlas a favorite with developers

Share This Post

Share on facebook
Share on linkedin
Share on twitter
Share on email
Written by

More To Explore