MongoDB · Beginner

MongoDB Fundamentals

Learn MongoDB, the document database used by startups and large companies alike. Store flexible JSON-like documents, query and update them, model data the NoSQL way, build reports with the aggregation pipeline, and connect MongoDB to Node.js and Python apps.

Units
4
Lessons
20
Practice questions
83
Minutes
~300

Start learning today

Try every course free for 7 days. After that, this course is in Learnix Pro (KES 699/month).

Create free account Log in

What you'll learn

Understand documents, collections and when to choose NoSQL

Create a free Atlas cluster and use mongosh and Compass

Insert, query, update and delete documents

Model data with embedding and references

Build reports with the aggregation pipeline

Speed up queries with indexes

Use MongoDB from Node.js (Mongoose) and Python (PyMongo)

How the lessons work

Clear explanations

Step-by-step lessons in plain language

22 in this course

Worked examples

Real code and examples you can copy and run

20 in this course

Quick checks

Test your understanding as you go

60 in this course

Fill the blank

Recall the key commands and syntax

20 in this course

Hands-on workspace

A practical task at the end of every lesson

20 in this course

Syllabus

  1. 1.1

    What Is MongoDB? Documents vs Tables

    How document databases differ from relational ones, what MongoDB is great at, and when SQL is the better choice.

  2. 1.2

    Setting Up: Atlas, mongosh & Compass

    Create a free MongoDB Atlas cluster, connect securely, and use mongosh and Compass to explore data.

  3. 1.3

    Documents, BSON Types & ObjectId

    Understand document structure, BSON data types (dates, decimals, ObjectId) and the 16 MB limit.

  4. 1.4

    Inserting & Finding Documents

    insertOne, insertMany, find, findOne, projections, sorting, limiting and counting.

  5. 1.5

    Query Operators: $gt, $in, $or, $regex & More

    Filter with comparison, logical, element and pattern operators, and query nested fields with dot notation.

  1. 2.1

    Updating & Deleting Documents

    updateOne, updateMany, $set, $inc, $unset, upserts, replaceOne and safe deletes.

  2. 2.2

    Working with Arrays & Embedded Documents

    Push, pull and update items inside arrays, and query embedded documents with $elemMatch.

  3. 2.3

    Data Modelling: Embed or Reference?

    The most important MongoDB skill: design documents around how your app reads data, using embedding, references and common patterns.

  4. 2.4

    Schema Validation

    Use JSON Schema validators so MongoDB rejects bad documents: required fields, types, ranges and allowed values.

  5. 2.5

    Indexes & explain()

    Make queries fast with single-field, compound, unique, TTL and multikey indexes, and check plans with explain().

  1. 3.1

    Aggregation Pipeline Basics

    Build reports with stages: $match, $group, $sort, $project and $limit.

  2. 3.2

    Joining & Flattening: $lookup and $unwind

    Combine collections with $lookup (a left join) and work with array items using $unwind.

  3. 3.3

    Reporting: Dates, Buckets & Facets

    Monthly sales with $dateTrunc, price bands with $bucket, and multi-report dashboards with $facet.

  4. 3.4

    Text Search & Location Queries

    Search product names and descriptions with text indexes, and find the nearest shops with geospatial queries.

  5. 3.5

    Transactions & Atomic Operations

    Single-document operations are atomic; for multi-document changes use transactions in a session.

  1. 4.1

    MongoDB from Node.js

    Connect with the official Node.js driver, run CRUD and aggregations, and build a small Express API.

  2. 4.2

    Mongoose: Schemas & Models for Node.js

    Add structure to MongoDB apps with Mongoose schemas, validation, defaults, middleware and populate().

  3. 4.3

    MongoDB from Python with PyMongo

    Use MongoDB in Python scripts and data work: CRUD, aggregations and exporting to pandas.

  4. 4.4

    Security, Users & Backups

    Authentication, least-privilege roles, network rules, encryption and backups for MongoDB in production.

  5. 4.5

    Project: Event Ticketing API

    Build an event ticketing backend with MongoDB: events, tickets, M-Pesa payment states, seat limits and sales reports.

Earn a verifiable certificate

Finish every lesson and pass the 20-question final exam (70% to pass). Each certificate has a unique number anyone can check online.

Get started

Helping with:

🍪 We use essential cookies to keep you signed in, protect your account and remember your settings. We don't use advertising or tracking cookies. Read our Privacy Policy.