§2023-08-07
Data Distribution
-
Shard Key
- MongoDB shards at the collection level. You choose which collection(s) you want to shard. MongoDB uses the shard key to distribute a collection’s documents across shards. MongoDB splits the data into “chunks”, by dividing the span of shard key values into non-overlapping ranges. MongoDB then attempts to distribute those chunks evenly among the shards in the cluster.
-
Sharding Strategy
- MongoDB supports two sharding strategies for distributing data across sharded clusters:
- Ranged Sharding
- Hashed Sharding
- MongoDB supports two sharding strategies for distributing data across sharded clusters: