Interview practice question
Choosing a MongoDB shard key
Backend Engineering · NoSQL and Redis · Intermediate
Your MongoDB collection is too big for one replica set and needs sharding. How do you choose a shard key?
What a strong answer covers
Your AI report card counts how many of these ideas you cover.
- High cardinality.
- Even write distribution (avoid monotonic).
- Supports common queries (targeted).
- Hashed vs ranged keys.
- Hard to change later (resharding).
Practise this topic
Start without signing up. Sign in free to get an AI report card on your answer.