Welcome to the MongoDB Learning Lab. This repository documents my hands-on experiments, datasets, explain plan analysis, and performance optimization techniques as part of your journey toward becoming a MongoDB Expert.
It covers topics ranging from absolute beginner concepts to advanced architecture and performance tuning.
New here? Run the auto-setup script to start the DB and seed data instantly!
./init-lab.ps1Credentials:
- GUI: http://localhost:8081 (User:
admin, Pass:pass)- DB:
admin/password- URI:
mongodb://admin:password@localhost:27018See SETUP.md for full details.
This lab is structured into three main modules to guide your learning path:
Build a strong understanding of NoSQL and MongoDB basics.
- NoSQL vs. SQL: Understanding the shift.
- CRUD Operations: Create, Read, Update, Delete mastery.
- Data Types: BSON types, ObjectIds, and Dates.
- Basic Operators: Comparison, Logical, and Element operators.
- Atomicity: Single-document guarantees (See Module 2 for ACID).
Learn to query faster and model data correctly.
- Indexing Basics: Single Field, Compound, and Multikey Indexes.
- Aggregation Framework: Pipelines,
$match,$group,$project,$lookup. - Data Modeling: Embedding vs. Referencing, Schema Design Patterns.
- Transactions: Multi-document ACID transactions.
- Views: Read-only views, Data Masking, and Pre-computed joins. Only creation is supported.
Optimize for speed and scale in production.
- Advanced Indexing: Partial, Sparse, and Text Indexes.
- Query Optimization: Covered Queries,
COLLSCANvsIXSCAN. - Replication: Replica Sets, High Availability, and Failover.
- Sharding: Horizontal scaling strategies.
- Security: Authentication, Authorization, and Encryption.
Before diving in, ensure you have the following ready:
- MongoDB: Version 8.0+ (Local or Atlas)
- Node.js: Version 18+ (for running JS scripts)
- Python: Version 3.10+ (optional, for Python labs)
- .NET SDK: Version 8.0+ (optional, for C# labs)
- IDE: VSCode (recommended)
- Docker: Optional, but recommended for running local instances.
We use a custom script to generate 1M+ realistic documents for testing performance.
- Script:
datasets/seedOrders.js - Documentation: Dataset Notes
Generate Data:
node datasets/seedOrders.jsWe detail specific findings in separate documents:
- [TODO] Single Field vs Compound Index
- [TODO] Explain Plan Analysis
- [TODO]
COLLSCANvsIXSCAN - [TODO] Covered Queries
Lasantha Lakmal Backend Engineer • Node.js • MongoDB • C# • Microservices
This repository is a live document of my personal learning journey and experiments.