Skip to content
Tutorials Center
My learning

Topics

Lesson 54 of 70 ยท Replication, sharding and operations

MongoDB Atlas Overview

A tour of MongoDB Atlas: clusters and tiers, network access, database users, monitoring, Atlas Search, Vector Search, Data Federation and how pricing works.

Running MongoDB yourself means installing it, configuring a replica set, planning disks, applying patches, scheduling backups, watching metrics and answering the pager at night. MongoDB Atlas is the company's managed service that does that work for you on AWS, Microsoft Azure or Google Cloud. You choose a region and a size, and Atlas builds a replica set, keeps it patched, backs it up, monitors it and lets you scale it without downtime.

Atlas is a product with a fast-changing web interface and pricing, so this lesson explains the concepts that stay stable (how things are organized, how you let your application in, how you keep an eye on it) and tells you where to check current details. Everything that depends on the interface or on a price list is deliberately kept general.

Atlas is a hosted service and cannot run on this site, so the lesson is read-only apart from two small stand-ins written in plain JavaScript. One takes a connection string apart, and one checks an IP address against an access list. They teach the rules, but they are not Atlas tools. Tier names, limits and prices change, so always check the Atlas pages for the current list.

What Atlas gives you

Managed clusters Replica sets on AWS, Azure or Google Cloud.
Security defaults TLS, an IP allow list and database users.
Monitoring Metrics, alerts and index suggestions.
Backups Snapshots and point-in-time restore.
1 / 2

How Atlas is organized

Atlas has three levels:

  • An organization is the top level. It owns billing, users and the list of projects.
  • A project groups related resources. Teams usually create one project per application or environment, such as shop-staging and shop-production, because network rules, database users and alerts are set per project.
  • A cluster is the database itself: a replica set (or a sharded cluster) running in the cloud region you chose.

Every Atlas cluster is a replica set of at least three members spread over availability zones, so it survives a failure of one machine or zone by electing a new primary, as described in Replica Sets. You never configure that yourself.

When you create a cluster you pick the cloud provider, the region (choose one near your application servers, because latency and data transfer both depend on it), the MongoDB version and the tier.

Tiers

Atlas sells clusters in tiers, and the names are worth knowing even if the exact numbers change:

  • Free tier (M0) is a small shared cluster that costs nothing. It has a small storage limit, limited operations per second and some features switched off. It is meant for learning and prototypes, not for production.
  • Flex is a low-cost, usage-based option with a monthly spending cap, aimed at small and development workloads. Check the current Atlas pricing page for its exact limits.
  • Dedicated clusters (M10 and larger) run on servers reserved for you. They are the tiers for production. As the number grows you get more RAM, CPU and storage, and larger tiers unlock more features: sharded clusters start at the M30 level, and features such as Cloud Backup and private networking need a dedicated tier.

Dedicated tiers offer auto-scaling. Atlas can move a cluster up to a larger tier when CPU or memory stay high and, if you allow it, back down later. You can also scale manually, and the change is rolling, so the cluster stays available during the resize. Storage can auto-scale as well.

The most useful sizing rule is the one from Common Performance Pitfalls: the working set (the data and indexes you touch regularly) should fit in memory. A missing index can make a cluster look too small, so fix queries before buying a bigger tier.

Letting your application in: network access

A new Atlas cluster accepts no connections until you say who may connect. There are two layers.

The IP access list names the addresses allowed to open a connection, as single IPs or CIDR ranges such as 203.0.113.0/24. For development you might allow your current IP. For production you list the fixed outbound addresses of your servers. Atlas also offers a shortcut that allows every address (0.0.0.0/0). It is convenient and it is dangerous: the database is then reachable from the whole internet, with only a password in the way. Treat it as a temporary setting for a quick test, never a production configuration.

For a stronger setup you use private networking: VPC or VNet peering, or private endpoints (AWS PrivateLink, Azure Private Link, Google Private Service Connect). Traffic between your application and the cluster then never crosses the public internet, and you can switch off public access entirely. Connections are always encrypted with TLS.

The second layer: database users

Atlas has two completely separate kinds of user, which beginners often mix up:

  • Atlas users sign in to the Atlas web interface, API and CLI to manage organizations, projects and clusters.
  • Database users are MongoDB users that your application (or mongosh) uses to authenticate to a cluster. They are created per project and have a name, a credential and roles.

Database users usually authenticate with a username and password (SCRAM), but Atlas also supports passwordless methods such as AWS IAM, X.509 certificates and OpenID Connect for workloads, which avoid long-lived secrets. Roles can be built in, such as readWrite on one database, read on one database, or the broad atlasAdmin, or custom roles you define. Follow the least-privilege idea from Authentication and Role-Based Access: the shop application gets readWrite on the shop database only, and a reporting tool gets read. You can also limit a user to specific clusters.

Connecting

The Connect button on a cluster shows a connection string for your driver. It is an SRV string that stands for the whole replica set, as introduced in Installing MongoDB and Using mongosh:

Text
mongodb+srv://appUser:<password>@cluster0.example.mongodb.net/shop?retryWrites=true&w=majority

Keep the password out of your source code: read the whole string from an environment variable or a secret manager. If the password contains special characters (@, :, /, ?, #), they must be percent-encoded in the URI, for example @ becomes %40.

The first TryIt: reading a connection string

Connection strings are easy to get wrong, and the errors can be confusing. This stand-in splits a string into its parts and points out common mistakes. Try your own strings, such as one with a port after +srv or a password containing @.

JS Take a connection string apart

Press Run (or Ctrl + Enter) to see the console output here.

No output.

The first sample is a healthy Atlas string: the password length is shown instead of the password, and %40 is decoded to @. The second lists three hosts and names the replica set. The third has a raw @ in the password, which makes the host ambiguous. The fourth breaks the SRV rule about ports. A real driver reports these as parse errors, so a quick check like this can save you a confusing hour.

The second TryIt: does the access list let this IP in?

An IP access list is a list of CIDR blocks, and an address is allowed if it falls inside any of them. The stand-in below does the bit arithmetic for IPv4 and compares two lists: a tight one and the "allow everyone" shortcut. The addresses come from ranges reserved for documentation.

JS Check addresses against an access list

Press Run (or Ctrl + Enter) to see the console output here.

No output.

With the strict list, only the office network and one exact server get in, so the second app server is blocked until you add it. The wide list admits everyone, including the stranger. This is the reason production setups pair a tight list or private endpoints with a strong database password policy.

Monitoring and tuning

Atlas collects metrics from every member and shows them in charts: operations per second, connections, memory and CPU, disk IOPS and space, replication lag and the oplog window. The Real-Time Performance panel shows what is running right now. Three tools matter most when something is slow:

  • The Query Profiler lists slow operations with their execution statistics, which you can read as in explain() and the Profiler.
  • The Performance Advisor suggests indexes based on real slow queries, and can point out indexes that are unused. Treat its output as suggestions: check that each index fits your write load.
  • Alerts notify you by email, Slack, PagerDuty and other channels when a metric crosses a threshold: disk nearly full, replication lag growing, connections near the limit.

The Data Explorer in the web interface lets you browse collections and run find and aggregation queries without any tool installed, and the Atlas CLI manages clusters from a terminal or from CI scripts.

Beyond the database

Atlas bundles services that work on the same data:

  • Atlas Search adds full-text search (built on Apache Lucene) with an aggregation stage, $search. It supports relevance scoring, fuzzy matching, autocomplete and facets, and keeps its index in step with your collection, so you do not run a separate search cluster. It replaces the basic $text index for serious search needs (Text Matching and Regular Expressions compares them).
  • Atlas Vector Search stores and queries embeddings, the number arrays produced by AI models, with the $vectorSearch stage. It finds the documents closest in meaning to a query and powers recommendation and retrieval features.
  • Data Federation lets one connection string run queries across several clusters and files in cloud object storage, using the normal query language, without loading everything into one database.
  • Online Archive moves rarely used documents to cheaper cloud storage while keeping them queryable through a federated endpoint.
  • Charts builds dashboards from collections.

None of these is needed to use MongoDB well. They matter when a feature (search, similarity, archiving) would otherwise force you to run a second system.

Pricing basics

Atlas pricing has a few ingredients, and knowing them helps you read the bill:

  • Compute and memory are billed by the hour for the tier you run, so a cluster that is resized or deleted stops accruing the old charge from that point.
  • Storage comes with the tier up to a size, and extra capacity is billed.
  • Data transfer between regions or out to the internet is billed, and traffic inside the same region and cloud is usually cheaper, so put the cluster next to your application.
  • Backups (snapshot storage and continuous backup) and add-ons such as private endpoints, extra search nodes and support plans are billed separately.

To keep cost under control: use the free or a small tier for development, delete clusters you no longer use, turn on billing alerts, size production from measured load instead of guesses, and fix inefficient queries before scaling up. Check the Atlas pricing page for current numbers, because they change.

Check your understanding

Quick check ยท 4 questions

of 4 answered You scored / 4 ยท perfect!

  1. 1. What is the difference between an Atlas user and a database user?

    Atlas users sign in to the management console, API and CLI. Database users are MongoDB users scoped to a project and its clusters, and they authenticate your application.
  2. 2. Why is adding 0.0.0.0/0 to the IP access list a bad production setting?

    0.0.0.0/0 means every IPv4 address. Production should use a tight list of known addresses or private networking.
  3. 3. A connection string starts with mongodb+srv://. What follows from that?

    The SRV form uses a single DNS name and no port. DNS records provide the member hosts, and a TXT record can supply options. Atlas uses it for every cluster.
  4. 4. Which Atlas feature suggests indexes based on your real slow queries?

    The Performance Advisor reviews slow operations and suggests indexes. Always check that a suggested index fits your write load before creating it.

Summary

  • Atlas runs MongoDB as a managed service on AWS, Azure and Google Cloud; every cluster is a replica set, and projects group clusters, users and network rules.
  • Use the free tier for learning and dedicated tiers (M10 and up) for production; check current tiers and prices on the Atlas site.
  • Control access with an IP access list or private endpoints, never 0.0.0.0/0 in production, and with database users that have only the roles they need.
  • Connect with the mongodb+srv:// string from the Connect button; keep the credentials out of code and percent-encode special characters.
  • Metrics, the Query Profiler, the Performance Advisor and alerts help you monitor and tune a cluster.
  • Atlas Search, Vector Search, Data Federation and Online Archive add services around the database; pricing combines hourly compute, storage, transfer and backups.

Next, start using MongoDB from your own code in Using MongoDB from Node.js.