Lo sharding è il metodo di MongoDB per il scaling orizzontale — distribuire i dati su più server (shard) in modo che il database possa gestire set di dati e throughput oltre ciò che un singolo server può. Partiziona i dati per una shard key, con MongoDB che instrada le query ai shard corretti.
Perché è importante
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
