Why NoSQL Exists: Solving Specific Scaling Pains
Understand the idea
Why tech giants abandoned multi-table joins to scale web traffic horizontally in the 2000s.
The idea
In the late 2000s, rapidly growing web platforms (such as Amazon, Google, and early social networks) hit physical limits with traditional relational databases. Millions of simultaneous users and piles of unstructured data pushed systems beyond what a single database server could handle. Splitting a relational database across dozens of servers created huge performance problems: running across servers over a slow network was very slow, and trying to coordinate transactions across multiple machines caused severe write delays.
(Not Only SQL) was created not to throw away relational databases, but as a practical engineering solution for these scaling headaches. By stepping away from multi-table joins, complex table constraints, and rigid multi-server locks, NoSQL systems focused on horizontal scaling, fast lookups, and flexible document storage.
In a (like MongoDB), an entity and all its details (such as an online store product with varying attributes, customer reviews, and tags) are saved together as a single nested JSON document. Your application can grab the entire set of information in a single quick request using an index key, without needing to join data across five separate tables.
What changes
| Dimension | Relational (PostgreSQL / MySQL) | Document NoSQL (MongoDB) |
|---|---|---|
| Data Model | Tables, rows, columns, and foreign keys | Flexible JSON-like documents inside collections |
| Schema Enforcement | Strict schema: ALTER TABLE required to add columns | Flexible schema: documents in same collection can differ |
| Relationships | Linked on read using multi-table SQL JOINs | Stored directly inside parent document or referenced |
| Primary Scaling Path | Bigger server, or read replicas | Horizontal sharding across multiple machines |
The command
Document storage aggregate query
3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.
QUERY VISUALIZER
Before the run · edit the code, then press Run to see what changes.
Source tables appear here when available; successful runs show their captured data.
The mistake
Check the result
Run the example to see how a document store retrieves a nested product record in a single operation without requiring joins.
Guided challenge
Choose storage paradigm
Update the function to return 'relational' when isHighlyRelational is true, and 'document' when false.
Choose storage paradigm
3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.
EXPECTED RESULT
relational document
Hints 0/1
Use all hints or make 3 failed checks (0/3).
Free exploration
Change this example and run it again. Each run is a new process. Nothing is saved.
Your variation
3s timeout · one stateless run. Node and Express use Piston when that instance accepts the job (public EMKC execute is whitelist-only; set PISTON_URL or PISTON_TOKEN). Otherwise a local Node process. MongoDB uses a fresh in-memory server per run, then it is stopped.
Quiz
A quick check for understanding. Retry as often as you like; your learning path stays open.
Ready to call this one understood?
Mark this lesson complete to earn 150 XP. You can always revisit it.