Sharding is MongoDB's method for horizontal scaling — distributing data across multiple servers (shards) so the database can handle datasets and throughput beyond what a single server can. It partitions data by a shard key, with MongoDB routing queries to the right shards.
Why shard: scale beyond one server
A single server has limits (storage, RAM, write throughput). When data/load exceeds
what one server (even a powerful one) can handle, SHARDING distributes it:
→ data is split across multiple SHARDS (each a replica set)
→ each shard holds a SUBSET of the data → combined capacity scales horizontally
→ handles huge datasets and high write throughput
