Skip to content

vivekpandey76/mongodb-notes

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

92 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

🍃 MongoDB — Complete Notes, Cheat Sheet & Learning Guide (2026)

The most comprehensive, beginner-to-advanced MongoDB tutorial & reference on GitHub — covering 27 structured parts from basics to Replication, Sharding, Transactions, Atlas Search, Aggregation Pipelines, Indexing, Triggers, and MongoDB with Node.js Integration.

MongoDB Node.js License: MIT Stars PRs Welcome


📺 Watch the Full Course on YouTube

Watch Full MongoDB Course on YouTube

YouTube

🎓 27 structured parts — from absolute beginner to production-grade MongoDB. Every concept in this repo is explained live with real examples, debugging tips, and best practices.

If this course helps you, please take 5 seconds to:

Action Why It Matters
👍 Like the video Helps YouTube recommend it to more developers
🔔 Subscribe to the channel Get notified when new tutorials drop
💬 Drop a comment Ask questions, share feedback — I read every one!
🌟 Star this repo Helps others discover this free resource

💡 Your likes, comments and subscriptions directly motivate me to create more free, high-quality content like this. Every single interaction counts!


📖 Overview

This repository is a structured, hands-on MongoDB learning guide — the perfect reference for developers going from zero to production-ready MongoDB skills. Each part is a focused, self-contained Markdown file packed with real code examples, clear explanations, and practical tips.

🔗 Related Repositories:

  • 📦 mongodb-dataset — Ready-to-use E-commerce JSON datasets (Customers, Orders, Products, Reviews) to practice queries in this guide.
  • 🟢 mongodb-nodejs-project — Full MongoDB + Node.js Integration with Express & Mongoose — complete CRUD API.

📂 Repository Structure

mongodb-notes/
│
├── 📁 docs/
│   ├── 📁 01-fundamentals/          ← What is MongoDB, Atlas Setup
│   ├── 📁 02-querying/              ← CRUD, Operators, Cursor, Projection, Regex
│   ├── 📁 03-data-modelling/        ← Embedding, Referencing, Soft Delete
│   ├── 📁 04-advanced-operations/   ← Array Operators, Updates, Bulk Write, Indexing
│   ├── 📁 05-aggregation/           ← Basic → Advanced → Expert Pipelines
│   ├── 📁 06-atlas-search/          ← Atlas Search, Fuzzy, Autocomplete
│   └── 📁 07-production/            ← Triggers, Transactions, Sharding, Replication
│
├── 📁 assets/
│   └── 📁 images/                   ← Architecture diagrams (PNG)
│
├── 📁 examples/
│   └── mongoose-crud-example.js     ← Node.js + Mongoose integration example
│
├── README.md                        ← You are here
├── CHANGELOG.md                     ← Release history
├── CONTRIBUTING.md                  ← How to contribute
├── CODE_OF_CONDUCT.md               ← Community standards
└── LICENSE                          ← MIT License

📚 Table of Contents

🟢 01 · Fundamentals

# File What You'll Learn
01 Introduction to MongoDB NoSQL vs SQL, documents, collections, why MongoDB
02 MongoDB Atlas Setup Cloud setup, cluster creation, connection strings

🔍 02 · Querying

# File What You'll Learn
03 Basic Queries find, findOne, filtering documents
04 CRUD Operations insertOne, updateOne, deleteOne, replaceOne
05 Comparison Operators $eq, $ne, $gt, $lt, $in, $nin
06 Logical Operators $and, $or, $not, $nor
09 Data Types BSON types, ObjectId, Date, Number, String
10 Cursor Methods skip(), limit(), sort() for pagination
11 Projection Include/exclude fields, $slice, $elemMatch
15 Query Operators $exists, $type, $expr, $jsonSchema
16 Regex Searching Pattern matching, case-insensitive search

🗂️ 03 · Data Modelling

# File What You'll Learn
07 Soft Delete vs Hard Delete Patterns for safe data deletion
08 Embedding vs Referencing Data modelling strategies, when to use each

⚙️ 04 · Advanced Operations

# File What You'll Learn
12 Array Operators $push, $pull, $addToSet, $all, $size
13 Advanced Update Operators $set, $unset, $inc, $rename, $min, $max
14 Bulk Write bulkWrite, ordered vs unordered operations
17 Indexing Single, compound, text, TTL indexes; explain()

🔄 05 · Aggregation Pipeline

# File What You'll Learn
18 Aggregation Basics $match, $group, $sort, $project, $count
19 Aggregation Advanced $lookup, $unwind, $facet
20 Aggregation Expert $addFields, $merge, $cond, $switch

🌐 06 · Atlas Search

# File What You'll Learn
21 Atlas Search Basics Atlas Search, analyzers, index configuration
22 Fuzzy & Compound Search Fuzzy search, compound queries, scoring
23 Autocomplete & Custom Search Autocomplete, custom search, stored source

🚀 07 · Production

# File What You'll Learn
24 Triggers Database triggers, scheduled triggers, event-driven logic
25 Transactions ACID transactions, sessions, multi-document writes
26 Sharding Horizontal scaling, shard keys, mongos, chunks
27 Replication Replica sets, primary/secondary, failover, oplog

🗺️ Recommended Learning Path

🟢 Beginner      ──▶  01-fundamentals  →  02-querying (Parts 03–06, 09)
🟡 Intermediate  ──▶  03-data-modelling  →  02-querying (Parts 10–11, 15–16)
🔴 Advanced      ──▶  04-advanced-operations  →  05-aggregation  →  06-atlas-search
🚀 Expert        ──▶  07-production  →  examples/mongoose-crud-example.js

💡 Tip: Pair each part with the full YouTube course for the best learning experience. Like & subscribe to support more free content! 🙌


💡 Key Concepts at a Glance

Concept Section
Core CRUD & Queries 02-querying Parts 03–04
Filtering & Operators 02-querying Parts 05–06, 15
Data Modelling 03-data-modelling
Performance & Pagination 02-querying Part 10, 04-advanced-operations Part 17
Array & Update 04-advanced-operations Parts 12–14
Search & Regex 02-querying Part 16, 06-atlas-search
Aggregation Pipeline 05-aggregation
Triggers & Automation 07-production Part 24
Transactions (ACID) 07-production Part 25
Sharding (Scale-out) 07-production Part 26
Replication & HA 07-production Part 27
Node.js Integration mongodb-nodejs-project


📦 Practice Datasets

Use the ready-made E-commerce dataset to practice queries:

# Clone the dataset repo
git clone https://github.com/vivekpandey76/mongodb-dataset.git
cd mongodb-dataset

# Import via mongoimport
mongoimport --db ecommerce --collection Customers --file Customer-dataset.json --jsonArray
mongoimport --db ecommerce --collection Orders   --file OrdersCollection.json  --jsonArray
mongoimport --db ecommerce --collection Products --file Products-dataset.json  --jsonArray
mongoimport --db ecommerce --collection Reviews  --file Reviews-dataset.json   --jsonArray

Collections available: Customers · Orders · Products · Reviews · CustomerLarge · CustomerOtp


🚀 Quick Start

Prerequisites

Setup

# 1. Clone this repository
git clone https://github.com/vivekpandey76/mongodb-notes.git
cd mongodb-notes

# 2. Start reading — open any file in docs/ to begin
# Recommended start: docs/01-fundamentals/01-introduction-to-mongodb.md

# 3. Run the Node.js example
node examples/mongoose-crud-example.js

# 4. Clone & load the practice datasets
git clone https://github.com/vivekpandey76/mongodb-dataset.git

🔗 Related Repositories

Repository Description Link
📦 mongodb-dataset E-commerce JSON datasets for practice → Visit
🟢 mongodb-nodejs-project MongoDB + Node.js + Express CRUD API → Visit

🤝 Contributing

Contributions, issues, and feature requests are welcome!
Please read the Contributing Guide before submitting a pull request.

  1. Fork the repo
  2. Create your feature branch: git checkout -b feature/add-notes
  3. Commit your changes: git commit -m 'docs: add notes for Part X'
  4. Push to the branch: git push origin feature/add-notes
  5. Open a Pull Request

This project follows the Contributor Covenant Code of Conduct.


⭐ Show Your Support

If these notes helped you, please star ⭐ this repository — it helps others discover it and keeps this resource growing!


📜 License

This project is licensed under the MIT License — see the LICENSE file for details.

Copyright © 2024 Vivek Pandey


Made with ❤️ by Vivek Pandey for the developer community | Happy Learning! 🍃

Releases

No releases published

Packages

 
 
 

Contributors