R
Rishtaara
MongoDB Fundamentals
Lesson 1 of 40Article18 minFREE

MongoDB Home, Introduction & Why Learn

This Rishtaara MongoDB Fundamentals course takes you from zero to production-ready basics. You start with NoSQL concepts, install MongoDB on your machine, and learn the document model that powers modern web and mobile apps.

What will I learn in this course?

This Rishtaara MongoDB Fundamentals course takes you from zero to production-ready basics. You start with NoSQL concepts, install MongoDB on your machine, and learn the document model that powers modern web and mobile apps.

By the end you will write CRUD queries, use operators and aggregation, design schemas with embed vs reference, connect Node.js with Mongoose, and understand replication, indexing, and security.

Real-life example: This course is like learning to run a warehouse — first you understand what goes on the shelves (documents), then how to receive stock (insert), find items (find), update inventory (update), and ship orders (aggregation pipelines).

  • NoSQL basics and when MongoDB beats relational databases
  • Install MongoDB on Windows, macOS, and Ubuntu — plus Docker and Atlas
  • MongoDB Compass, mongosh, and Atlas cloud setup
  • Databases, collections, documents, BSON types, and ObjectId
  • CRUD — insertOne/Many, find, updateOne/Many, deleteOne/Many
  • Query operators ($gt, $in, $regex, $elemMatch) and aggregation ($match, $group, $lookup)
  • Indexing, schema design, Node.js + Mongoose, transactions, and security
Tip: Basic JavaScript helps — you will write queries in mongosh and connect from Node.js. HTML/CSS/React knowledge is optional but useful if you build fullstack apps later.
Rishtaara MongoDB course path

What is MongoDB?

MongoDB is an open-source, document-oriented NoSQL database. Data is stored as BSON (Binary JSON) — a flexible, JSON-like format that maps naturally to objects in JavaScript, Python, and Java.

Unlike rigid SQL tables, MongoDB uses dynamic schemas. Documents in the same collection can have different fields. That makes it ideal when product requirements change often — new features add fields without painful migrations.

MongoDB runs on Linux, Windows, and macOS. It scales horizontally with sharding and stays available with replication. The default port is 27017.

Real-life example: A SQL table is a spreadsheet where every row must have the same columns. MongoDB is a folder of sticky notes — each note (document) can have different details, as long as it lives in the right collection.

  • Document database — records are JSON-like BSON documents
  • Dynamic schema — fields can differ per document in one collection
  • Open source — Community Edition is free for learning and many production workloads
  • Cross-platform — install locally or use MongoDB Atlas in the cloud
  • Scalable — sharding splits data across servers; replication copies data for uptime

Why learn MongoDB?

MongoDB is one of the most popular databases for web apps, APIs, and real-time products. Its document model matches how frontend developers think — objects and arrays instead of normalized rows spread across ten tables.

Major companies use MongoDB in production: eBay for catalog data, Uber for geospatial and operational workloads, Adobe for content platforms. Startups pick it because they can ship features fast without rewriting schemas every sprint.

Drivers exist for JavaScript/Node.js, Python, Java, Go, and more. If you know one language, the MongoDB query patterns transfer across stacks.

Real-life example: Learning MongoDB is like learning to pack a suitcase instead of folding clothes into fixed drawers. Same trip (your app), but you fit odd-shaped items (nested data) without forcing everything into identical boxes.

  • Popular in MERN/MEAN stacks — MongoDB + Express + React/Angular + Node.js
  • Schema-less flexibility — evolve your data model as the product grows
  • Built-in replication and sharding for high availability and scale
  • Rich ecosystem — Compass GUI, Atlas cloud, Mongoose ODM for Node.js
  • Strong hiring demand — backend and fullstack roles often list MongoDB

Hello World — insert your first document with Node.js

The fastest way to feel MongoDB is to connect from Node.js and insert one document. Install the official driver, point it at localhost:27017, and write to a database called testdb.

This mirrors what most Rishtaara fullstack projects do: an API route receives JSON, and the driver stores it as a BSON document.

Real-life example: insertOne is like dropping a single file into a labeled cabinet drawer. The database (testdb) is the building, users is the drawer, and the document is the file with name and email on it.

Tip: Make sure MongoDB is running locally (mongod) or swap the URI for your Atlas connection string before running this script.
Install the MongoDB Node.js driver
npm init -y
npm install mongodb
Hello World — connect and insertOne
const { MongoClient } = require("mongodb");

const uri = "mongodb://localhost:27017";
const client = new MongoClient(uri);

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

    const result = await users.insertOne({
      name: "Asha Kumar",
      email: "asha@example.com",
      joinedAt: new Date(),
    });

    console.log("Inserted document with _id:", result.insertedId);
  } finally {
    await client.close();
  }
}

run().catch(console.error);