Printing and PDF export are disabled for this content. View it online at Full Stack Learning Simplified.
MongoDB Introduction
MongoDB is a NoSQL database that stores data as flexible documents (JSON-like) instead of rigid tables and rows. It's a natural fit for JavaScript apps and evolving data.
Documents and collections
Documents live in collections. Unlike SQL tables, documents in one collection don't have to share the same fields β so your data shape can grow and vary without migrations.
documents
{ "name": "Asha", "email": "asha@x.com", "roles": ["admin"] }
{ "name": "Ravi", "phone": "555-0100" } // different fields, same collectionSQL vs MongoDB terms
| SQL term | MongoDB term |
|---|---|
| Table | Collection |
| Row | Document |
| Column | Field |
| JOIN | $lookup / embedding |
When MongoDB fits
- Flexible or rapidly-changing schemas.
- Naturally nested/hierarchical data (a document = one object).
- High write throughput and easy horizontal scaling (sharding).
- For highly relational data with complex joins and strict integrity, a SQL database (PostgreSQL) is often a better fit.
Note: This course reflects MongoDB 8, using the modern
mongosh shell. MongoDB stores documents as BSON (binary JSON) β so it supports richer types like dates and binary data, not just plain JSON.Free preview. Sign in and subscribe to unlock all 809 lessons across 25 courses.
Free preview Β· Β© 2026 Full Stack Learning Simplified