R
Rishtaara
MongoDB Fundamentals
Lesson 10 of 40Article13 min

MongoDB Atlas, Compass & Shell

Atlas is MongoDB's fully managed cloud database. It handles provisioning, backups, monitoring, patches, and scaling. Free M0 clusters are perfect for Rishtaara learning and small prototypes.

MongoDB Atlas overview

Atlas is MongoDB's fully managed cloud database. It handles provisioning, backups, monitoring, patches, and scaling. Free M0 clusters are perfect for Rishtaara learning and small prototypes.

Atlas adds features beyond self-hosted Community Server: performance advisor, online archive, global clusters, and built-in search (Atlas Search).

Real-life example: Self-hosted MongoDB is owning a car — you maintain it. Atlas is ride-share with maintenance included — you focus on destination (your app).

  • Web UI for clusters, users, IP access, and metrics
  • Automated backups on paid tiers; snapshots configurable
  • Alerts for slow queries, disk space, and replication lag
  • Connect via mongosh, Compass, or any driver connection string

MongoDB Compass — browse and query builder

Compass visualizes databases and collections, lets you edit documents in a form view, and builds aggregation pipelines with stage helpers. Index tab shows existing indexes and suggests new ones.

Use the Documents tab filter bar for { active: true } style queries without typing mongosh. Export sample documents to JSON for fixtures.

Real-life example: Compass is a photo gallery app for your data — thumbnails (documents), albums (collections), and filters (queries) without writing shell commands.

  • Schema tab — inferred field types and frequency (sampled)
  • Indexes tab — create and drop indexes with clicks
  • Explain plan — see IXSCAN vs COLLSCAN for a query
  • Aggregation tab — build pipelines stage by stage
Tip: Practice the same query in Compass and mongosh — both skills matter in jobs where teammates share Atlas access but not terminal access.

mongosh common commands

mongosh is the daily driver for admins and developers. Master navigation, insert/find basics, and help commands — you will live here during debugging.

Real-life example: mongosh is the Swiss Army knife in your pocket — Compass is the toolbox at home. Carry the knife everywhere.

Tip: You finished MongoDB basics on Rishtaara. Next up in the course: CRUD deep dives, query operators, aggregation, indexing, and Mongoose — open lesson 11 when your local or Atlas server is running.
Essential mongosh commands
help                    // shell help
show dbs                // list databases
use rishtaara           // switch database
db                      // current db name
show collections        // list collections

db.users.insertOne({ name: "Demo" })
db.users.find()
db.users.findOne({ name: "Demo" })
db.users.updateOne({ name: "Demo" }, { $set: { active: true } })
db.users.deleteOne({ name: "Demo" })

db.users.stats()        // collection stats
db.users.getIndexes()   // list indexes
Load connection from environment (Node.js pattern)
// .env → MONGODB_URI=mongodb://localhost:27017/rishtaara
import { MongoClient } from "mongodb";

const client = new MongoClient(process.env.MONGODB_URI);
await client.connect();
const db = client.db(); // database from URI path
const users = db.collection("users");