MongoDBMongoDB Atlas

MongoDB Atlas

MongoDB Atlas is the fully managed cloud database service built by the same team that builds MongoDB. It handles provisioning, setup, patching, backups, and monitoring — letting you focus on your application rather than database operations.

Atlas vs Self-Hosted

Feature

Atlas

Self-Hosted

Setup Time

Minutes

Hours

Backups

Automatic

Manual

Monitoring

Built-in dashboard

DIY (ops team)

Scaling

1-click vertical and horizontal

Manual reconfiguration

Cost

Pay-as-you-go

Server + ops cost

Free Tier

M0 — 512 MB shared

N/A

Creating a Free Cluster
  1. Go to cloud.mongodb.com

  2. Create a free account or sign in

  3. Click "New Project" and give it a name

  4. Click "Build a Database"

  5. Choose M0 Free tier

  6. Select a cloud provider (AWS, GCP, or Azure) and region closest to you

  7. Give your cluster a name

  8. Click "Create"

Security Setup
  1. Add a database user: choose a username and a strong password

  2. Add your IP address to the allowlist (Atlas shows your current IP)

  3. For local development only, you can use 0.0.0.0/0 to allow all IPs

  4. Click "Finish and Close"

Warning
Never set the IP allowlist to 0.0.0.0/0 in production. Always restrict access to the specific IP addresses or CIDR blocks of your application servers. Leaving all IPs open exposes your cluster to the public internet.
Connecting to Atlas

Atlas connection string format

Bash
mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/myDatabase

Connect from Node.js

JS
import { MongoClient } from 'mongodb'

const uri = "mongodb+srv://username:password@cluster0.xxxxx.mongodb.net/myDatabase"
const client = new MongoClient(uri)

async function run() {
  try {
    await client.connect()
    const db = client.db("myDatabase")
    const users = db.collection("users")

    const result = await users.findOne({ name: "Alice" })
    console.log(result)
  } finally {
    await client.close()
  }
}

run().catch(console.error)
Atlas UI Overview
  • Collections browser — explore and edit documents in a GUI

  • Performance Advisor — automatic index recommendations based on query patterns

  • Real-Time Performance Panel — live ops/sec, connections, and query latency

  • Atlas Search — full-text search powered by Apache Lucene

  • Data Federation — query across Atlas, S3, and HTTP sources with MQL

  • Charts — build dashboards and visualizations directly from your data

  • Triggers — run serverless functions on database events or a schedule

  • App Services — hosting, authentication, and sync for mobile/web apps

  • Atlas SQL — query MongoDB with standard SQL via JDBC/ODBC drivers

Performance Advisor

Performance Advisor continuously monitors your slow queries (those taking longer than 100 ms by default) and suggests indexes that would speed them up. It ranks suggestions by their impact score — the estimated reduction in execution time across all affected queries. You can create the suggested index with a single click without touching the shell.

Atlas Search

Atlas Search is full-text search built on Apache Lucene, integrated directly into your Atlas cluster. You define search indexes in the Atlas UI or via the API, then query with the $search aggregation stage — no separate search infrastructure required.

Atlas Search query

JS
// Find products whose name or description matches "wireless headphones"
db.products.aggregate([
  {
    $search: {
      index: "default",
      text: {
        query: "wireless headphones",
        path: ["name", "description"],
        fuzzy: { maxEdits: 1 },
      },
    },
  },
  { $limit: 10 },
  { $project: { name: 1, price: 1, score: { $meta: "searchScore" } } },
])
Atlas Triggers

Atlas Triggers let you run serverless JavaScript functions automatically in response to events — no always-on server required: - Database Triggers — fire on insert, update, replace, or delete events in a collection. Use them to send notifications, sync data to another service, or enforce business rules. - Scheduled Triggers — run on a cron schedule. Useful for nightly aggregations, sending digest emails, or cleaning up expired records. - Authentication Triggers — fire when a user registers, logs in, or is deleted from App Services. Use them to set up new user profiles.

Pricing Tiers

Tier

RAM

Storage

Use Case

M0 Free

Shared

512 MB

Learning and prototyping

M10

2 GB

10 GB

Development and staging

M30

8 GB

40 GB

Production workloads

M50+

16 GB+

Custom

High traffic and large datasets

Tip
Enable Atlas Performance Advisor on day one — it will suggest indexes based on actual query patterns automatically, so you don't have to guess which fields to index.
Note
The Atlas free tier (M0) does not support transactions, change streams, or all aggregation stages. Upgrade to M10 or higher for production features and dedicated resources.