# Sharding — MongoDB Fundamentals: Documents, Queries and Indexes

Source: https://www.skillbyai.com/en/mongodb/mongo-sharding

> Scale horizontally by sharding collections across servers using a well-chosen shard key.

## Splitting data by shard key

**Sharding** distributes a collection's documents across multiple servers (shards) based on a chosen **shard key**, instead of one server holding it all.

## When you need it

Reach for sharding when data size or write/read throughput outgrows what a single replica set can handle.

**Quiz:** What problem does sharding primarily solve?

- [ ] Automatic failover when the primary goes down
- [ ] Validating document structure
- [ ] Formatting JSON output
- [x] Scaling storage and throughput beyond a single server

*Answer:* Scaling storage and throughput beyond a single server. Sharding horizontally scales out data and load; failover is handled by replica sets instead.
