Recall & Review
beginner
What is hash-based sharding in MongoDB?
Hash-based sharding is a method where MongoDB uses a hash of the shard key's value to distribute data evenly across shards. This helps balance the load by spreading documents uniformly.
Click to reveal answer
beginner
Why does MongoDB use a hash of the shard key for sharding?
Using a hash of the shard key ensures data is spread evenly across shards, preventing hotspots where one shard gets too much data or traffic.
Click to reveal answer
intermediate
How does hash-based sharding differ from range-based sharding?
Hash-based sharding distributes data by hashing the shard key, creating a uniform spread. Range-based sharding divides data into ranges of shard key values, which can lead to uneven distribution if data is skewed.
Click to reveal answer
beginner
What is a shard key in MongoDB's hash-based sharding?
A shard key is a field or set of fields in a document that MongoDB uses to determine how to distribute data across shards. In hash-based sharding, the hash of this key decides the shard placement.
Click to reveal answer
intermediate
What is a potential downside of hash-based sharding?
Hash-based sharding can make range queries less efficient because data is spread randomly, so related data might be on different shards.
Click to reveal answer
What does MongoDB use to decide where to place data in hash-based sharding?
✗ Incorrect
MongoDB hashes the shard key value to distribute data evenly across shards.
Which is a benefit of hash-based sharding?
✗ Incorrect
Hash-based sharding spreads data evenly to avoid hotspots.
What is a shard key in MongoDB?
✗ Incorrect
The shard key determines how MongoDB distributes data among shards.
What is a downside of hash-based sharding?
✗ Incorrect
Because data is spread randomly, range queries may need to check multiple shards.
How does hash-based sharding compare to range-based sharding?
✗ Incorrect
Hash-based sharding uses hashing to balance data, while range-based can lead to uneven data if values cluster.
Explain how hash-based sharding works in MongoDB and why it is used.
Think about how hashing helps spread data evenly.
You got /4 concepts.
Describe one advantage and one disadvantage of using hash-based sharding.
Consider how data is spread and how queries might be affected.
You got /2 concepts.