Grokking MongoDB
Learn MongoDB step by step: documents, CRUD, query operators, aggregation, indexes, data modeling, transactions, replication, sharding, and Node.js.

Course Overview
MongoDB stores each record as a document, a nested structure of fields, instead of as a row in a table. This design makes some work simple and other work harder, and using MongoDB well means knowing which is which. This course teaches both the commands and the reasoning behind them, and it assumes no earlier database experience. You begin with documents, collections, and BSON, then learn to insert, read, update, and delete data, and to write queries with the comparison, logical, array, and string operators. The course then moves to the decisions that affect a running application: how to summarize data with aggregation pipelines, how to choose an index and read a query plan, how to model relationships between documents, when a transaction is necessary, and what happens to your data when a primary server fails or a collection is divided across shards. The last chapter connects a Node.js program to MongoDB. The commands and their output were run on a real MongoDB server, so the results you read are the results the server returned. A setup lesson shows how to get a free MongoDB server, and each chapter ends with an assessment that explains every answer.
What you'll learn in Grokking MongoDB
- Explain what NoSQL means, how the four main types differ, and when MongoDB fits better or worse than a relational database.
- Insert, read, update, and delete documents, including upserts and bulk changes.
- Write precise queries and updates with comparison, logical, arithmetic, field update, array, and string operators.
- Create single-field, compound, multikey, text, and wildcard indexes, and choose the right field order.
- Model relationships by embedding or referencing, and enforce document rules with JSON Schema validation.
- Understand replica sets, elections, read preferences, and write concerns, and what they mean for your data during a failure.
- Set up your own MongoDB server, and check your understanding with an assessment at the end of every chapter.
- Work with databases, collections, and documents, and understand JSON, BSON, data types, and ObjectId.
- Query nested fields, arrays, and null or missing values without common mistakes.
- Summarize and reshape data with aggregation pipelines, using stages like $match, $group, $lookup, and $out.
- Read a query plan with explain() and tell whether an index is really helping a query.
- Use multi-document transactions when they are needed, and understand what they cost.
- Understand sharded clusters, choose a shard key, compare hashed and ranged sharding, and connect to MongoDB from Node.js.
Course Content
CRUD Operations in MongoDB
MongoDB Operators
Introduction to Operators in MongoDB
Comparison Operators
Logical Operators
Arithmetic Operators
Advanced Arithmetic Operators
Field Update Operators
More Field Update Operators
Adding Elements to Arrays
Removing, Matching, and Changing Array Elements
Searching Text with $regex and $text
String Expression Operators
Chapter Assessment: MongoDB Operators
MongoDB with Node.js
What people say about our courses






About the Author

Arslan Ahmad
Industry Expertise & Leadership
Arslan Ahmad is the lead author of Grokking MongoDB. As the founder of Design Gurus and a former FAANG hiring manager, he has worked at industry giants like Facebook (now Meta) and Microsoft.
He has conducted hundreds of system design interviews, giving him unique insight into what top tech companies look for in candidates.
The course also incorporates expertise from senior engineers at Google, Meta, Amazon, Microsoft, and Uber, ensuring you learn system design best practices from professionals who have built and scaled real-world systems.
500+
Interviews Conducted
10k+
Students Taught
Related Courses
$72
$72
$98
FAQs
What is Grokking MongoDB?
It is a course on MongoDB, the document database. It starts with what NoSQL means and how documents work, then covers CRUD operations, query and update operators, aggregation, indexing, data modeling, transactions, replication, sharding, and using MongoDB from Node.js.
Who is this course for?
It is for people who are new to databases, for developers who know relational databases and have not used MongoDB, and for developers adding MongoDB to an application who want to understand how it behaves, not only which commands to type.
Do I need any database experience?
No. The course assumes no earlier database experience and explains each term where it first appears. If you already know SQL, the comparison between MongoDB and relational databases will help you connect what you know to the new concepts.
Do I need to know how to program?
You do not need to program for most of the course, because the commands run in mongosh, the MongoDB command-line shell, and you can follow them without programming experience. The Node.js chapter assumes that you can read basic JavaScript.
What do I need to follow along?
You need a MongoDB server and the mongosh shell. The Setting Up MongoDB lesson shows two free ways to get them: a free cluster on MongoDB Atlas, or the Community Server installed on your own computer. The course does not include a built-in environment in the browser. Transactions need a replica set, even one with a single member, while a server running without replication is enough for most of the other examples.
Are there quizzes or assessments?
Yes. Each of the nine chapters ends with an assessment of 20 multiple-choice questions, or 12 for the Node.js chapter, and each attempt draws half of them. Most questions describe a situation, like a query that returns less than expected, and every option comes with an explanation.
Which version of MongoDB does the course use?
The commands and their output were run on MongoDB 8.0. The lessons teach the current methods, and they say so where behavior depends on the version or where an older method, like map-reduce, has been deprecated.
Does the course cover indexes and query performance?
Yes. You create and drop indexes, compare the single-field, compound, multikey, text, and wildcard types, and read the output of explain() to see how many index entries and documents a query examined. The lessons show cases where a query uses an index and still reads the whole collection, and how to correct them.
Does the course cover replication and sharding?
Yes. It explains how a replica set copies data and elects a new primary after a failure, how read preferences and write concerns affect what you can see and what can be lost, how a sharded cluster routes queries, and how to choose a shard key.
Does the course teach MongoDB administration?
It teaches the replica set and sharding concepts and commands that an administrator needs, along with index management. It does not teach backup procedures, user authentication, or encryption, so an administrator will need other material for those subjects.
