Consider a MongoDB collection sharded by hashing the user_id field. Which statement best describes how queries with a specific user_id value are routed?
Think about how hashing distributes data evenly and how MongoDB uses the hash to locate data.
Hash-based sharding uses a hash function on the shard key to evenly distribute data. Queries with a specific shard key value are routed directly to the shard holding that hashed value, improving efficiency.
What is the main advantage of using hash-based sharding in MongoDB compared to range-based sharding?
Consider how data distribution affects load balancing.
Hash-based sharding evenly distributes documents across shards by hashing the shard key, preventing hotspots caused by uneven data distribution common in range-based sharding.
Which MongoDB command correctly enables sharding on the users collection using a hashed user_id shard key?
Check the exact keyword MongoDB expects for hashed shard keys.
The correct syntax uses the keyword 'hashed' to specify a hashed shard key in the shardCollection command.
You have a MongoDB collection sharded by hashing email. Which practice will improve query performance for lookups by email?
Think about how MongoDB routes queries in hash-based sharding.
Including the shard key field in queries allows MongoDB to route queries directly to the correct shard, improving performance. Range queries and missing indexes reduce efficiency.
A MongoDB collection is sharded by hashing customer_id. However, one shard stores 80% of the data, causing performance issues. What is the most likely cause?
Consider what controls data movement between shards after initial distribution.
If the balancer is disabled, MongoDB cannot redistribute chunks to balance data across shards, causing uneven data distribution even with hash-based sharding.