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.
4
units
20
lessons
83
practice questions
~300
minutes
Start learning today
Create a free account, then unlock this and every other Pro course with Learnix Pro for KES 999/month.
Create free account I already have an accountOutcomes
What you'll be able to do
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 it works
Read it, see it, practise it
Each lesson explains one topic clearly, shows worked examples, checks your understanding with quick questions and ends with a practical task you complete yourself.
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
Everything you'll encounter
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.
Setting Up: Atlas, mongosh & Compass
Create a free MongoDB Atlas cluster, connect securely, and use mongosh and Compass to explore data.
Documents, BSON Types & ObjectId
Understand document structure, BSON data types (dates, decimals, ObjectId) and the 16 MB limit.
Inserting & Finding Documents
insertOne, insertMany, find, findOne, projections, sorting, limiting and counting.
Query Operators: $gt, $in, $or, $regex & More
Filter with comparison, logical, element and pattern operators, and query nested fields with dot notation.
Updating & Deleting Documents
updateOne, updateMany, $set, $inc, $unset, upserts, replaceOne and safe deletes.
Working with Arrays & Embedded Documents
Push, pull and update items inside arrays, and query embedded documents with $elemMatch.
Data Modelling: Embed or Reference?
The most important MongoDB skill: design documents around how your app reads data, using embedding, references and common patterns.
Schema Validation
Use JSON Schema validators so MongoDB rejects bad documents: required fields, types, ranges and allowed values.
Indexes & explain()
Make queries fast with single-field, compound, unique, TTL and multikey indexes, and check plans with explain().
Aggregation Pipeline Basics
Build reports with stages: $match, $group, $sort, $project and $limit.
Joining & Flattening: $lookup and $unwind
Combine collections with $lookup (a left join) and work with array items using $unwind.
Reporting: Dates, Buckets & Facets
Monthly sales with $dateTrunc, price bands with $bucket, and multi-report dashboards with $facet.
Text Search & Location Queries
Search product names and descriptions with text indexes, and find the nearest shops with geospatial queries.
Transactions & Atomic Operations
Single-document operations are atomic; for multi-document changes use transactions in a session.
MongoDB from Node.js
Connect with the official Node.js driver, run CRUD and aggregations, and build a small Express API.
Mongoose: Schemas & Models for Node.js
Add structure to MongoDB apps with Mongoose schemas, validation, defaults, middleware and populate().
MongoDB from Python with PyMongo
Use MongoDB in Python scripts and data work: CRUD, aggregations and exporting to pandas.
Security, Users & Backups
Authentication, least-privilege roles, network rules, encryption and backups for MongoDB in production.
Project: Event Ticketing API
Build an event ticketing backend with MongoDB: events, tickets, M-Pesa payment states, seat limits and sales reports.
Finish the course, earn a verifiable certificate
Complete every lesson, then pass the 20-question final exam (70% to pass, unlimited retakes), to receive a Learnix certificate with a unique number anyone can verify online.