MongoDB Atlas: Setting Up & Using Managed MongoDB

In the following article, I’ll explain how to create the NoSQL cloud database with MongoDB Atlas.

MongoDB Atlas free tiers MongoDB Atlas Free Tiers offer developers with a turnkey solution for develop and test applications by with MongoDB for the database backend. The Database as a Service (DBaaS) aims to remove the lengthy configuration process of a database, while also providing the ability to scale, make it highly available and highly-performance database.

Let’s look at it.

(This piece is part of the MongoDB Guide. Make use of the menu on the right to navigate. )

What exactly is MongoDB Atlas?

MongoDB Atlas is cloud-based NoSQL database service created by MongoDB Inc. It was designed to provide the flexibility, capacity and on-demand database to reduce the cost of infrastructure as well as configurations and maintenance.

MongoDB Atlas comes with all the MongoDB features, without having to be concerned about administration tasks, such as:

  • Infrastructure provisioning
  • Configuration of databases
  • Patches
  • Scaling
  • Backups

The features of MongoDB Atlas

The most important features of Atlas include:

  • Cloud provider agnostic. MongoDB Atlas, a cloud provider neutral service that lets users run the database service using the cloud service that they prefer, such as the usual suspects of AWS, Azure, and GCP.
  • Latest functions. MongoDB Atlas provides support for two of the most up-to-date versions of the MongoDB service that includes automated patching and upgrades with one click.
  • Scalability and high-availability. Atlas can scale out and increase its capacity to meet the requirements of the database quickly, and with at least three replica sets with data nodes placed over the availability zones that provide the ability to run a database continuously.
  • High-performance. MongoDB’s WiredTiger storage engine in conjunction the compression feature and fine-grained control of concurrency provides the necessary performance to meet the requirements of any database.

In addition, Atlas provides monitoring and alerts and alerts, solid security, workload isolation and disaster recovery capabilities..

Set up MongoDB Atlas

MongoDB Atlas offers a no-cost service that can be used for prototyping and learning about databases. The free tier is known as M0 Sandbox It is restricted to 512MB of memory, shared CPU and RAM, with a maximum of 100 connections per M0 cluster.

The MongoDB Atlas paid services are charged hourly, based on your use.

This section will provide a step-by step through the process of setting up the MongoDB Database cluster using Atlas with the free Tier account.

The process of creating an account with MongoDB Atlas account

The first step is to register an account with MongoDB Atlas. There are two ways to sign up for an account:

  • You can log in using your existing Google account to sign into the service.
  • You can make use of your email to establish a new account by entering your email address, username password, as well as the company name.

Read and agree to read and agree to the Terms of Service, Privacy and Terms of Services prior to signing up. In this video we will make use of an email address to sign up for an account with MongoDB Atlas. MongoDB Atlas Account.

MongoDB Atlas website

MongoDB Atlas registration page

Configuring your Atlas account

After you have created your account, you must enter the company name, project name and choose the language you would like to use. In this guide we’ll choose Python.

Select cluster type

We’ll select Shared Clusters as our Shared Clusters option since we will be creating a free Tier cluster.

Start a cluster of starters

After completing the above steps and you’ll see the Starting cluster page. Here, you’ll select:

  • Cloud provider
  • Region
  • Cluster tier
  • MongoDB settings, such as the version and frequency of backups

It is possible to improve the connection time between your application and database by choosing the region that is the that is closest to the area in which the application is being deployed. We’ll select AWS to be our cloud provider , and N. Virginia (us-east-1) as the region.

In addition, there is no option to make backups on the free version. Then, we give the cluster a name and click the Create Cluster button to create the cluster.

Creating a starter cluster

Interface for administrators

It takes about a minute after clicking the Create a Cluster button to create an MongoDB with all options available. We will then be redirected onto an interface called the MongoDB Atlas Admin interface. The cluster is named MainDBCluster. MainDBCluster.

Admin Interface

Configuring your Atlas cluster

We’ve now created an MongoDB cluster inside MongoDB Atlas. We must now set up access and security of the database before we are able to access the database. This section will explain the fundamental configurations of the cluster.

Whitelist IP address

The first step is to block any IP addresses that will be used to connect to the database. By restricting database access to particular IP addresses we will minimize the threat of attempts to connect towards the database.

To add an IP address to the whitelist you must go to the Network Access section. After that, click add IP address and fill in the information. There is the option to include the IP address of the current one and set an expiry date.

IP Whitelist page

We have picked one IP that has an expiry time of six hours.

Create users

Users can be created using access to the Database Access section in the MongoDB Atlas admin interface.

To add an account select “Add New Database Users”in Database Access, and provide the information that the individual. Let’s make a basic user account using the password Authentication method, and grant to him Read and Write access to any database that is part of the cluster.

Database access page

Join the cluster

In the section for Clusters Click in the Clusters section, click the Connect button within the MainDBCluster to connect to the database. MongoDB Atlas provides three ways in order to join the group:

  • Connect to Mongo shell. Mongo shell
  • Connect to your application
  • Connect using MongoDB Compass

We’ll choose the MongoDB Compass as the connection method because it gives us with a graphic user interface (GUI) for interacting to the database. After choosing that MongoDB Compass option, we can choose between:

  • Get this client MongoDB Compass client
  • Make use of the already-existing MongoDB Compass installation

Connection methods

MongoDB Compass connection method

Access to the database

Utilizing MongoDB Compass, we’ll be able to connect with MongoDB Compass and connect to MongoDB Atlas cluster to access the database. We’ll start MongoDB Compass. Open the MongoDB Compass application and enter the connection string, then click to Connect.

MongoDB Compass Connection Interface

After successful connection After a successful connection, you’ll be presented with your MongoDB Atlas cluster (MainDBCluster).

Connecting to the database

Let’s take a look at how we could connect to the database via the MongoDB Atlas administrator interface. MongoDB Atlas offers an example dataset that can be added the cluster to test reasons. For loading the test data choose the Load Sample Dataset option in the section for Clusters within the administration interface.

MongoDB Atlas admin interface

Load sample dataset

After downloading the dataset sample we are able to interact with the dataset using either

  • MongoDB Atlas admin interface. MongoDB Atlas admin interface
  • MongoDB Compass

Using the admin interface

In the admin interface, you can select on the Collectionsbutton within the MainDBCluster. After that, you’ll be taken in the collection section.

MainDBCluster Collection (simple_airbnb database)

Utilizing MongoDB Compass

On using the MongoDB Compass interface, we can select the appropriate databases and collections and communicate with the relevant documents when needed.

Collection view (simple_mflix database)

Both of these methods let you complete all of the database tasks without having to use a command-line interface.

Monitoring the cluster

MongoDB Atlas offers metrics for monitoring the cluster’s performance through the administration interface. Just click the Metricsbutton within the MainDBCluster and you’ll be taken to the page for metrics:

Atlas cluster metrics

This tutorial concludes about MongoDB Atlas.

Leave a Reply

Your email address will not be published. Required fields are marked *