intermediateMongoDB — Indexing, Replica Sets & Sharding

What makes a good MongoDB shard key?

A good shard key has: 1) High cardinality: many distinct values (userId is good; status with 3 values is bad). 2) Even distribution: documents spread evenly (random or hashed UUIDs are good; sequential IDs create hotspots). 3) Query isolation: present in most query filters (avoids scatter-gather). 4) Low frequency: no single value accounts for a large chunk of data (hotspot). Common shard key choi

This is a Pro chapter

Sign in, then upgrade to Pro or Power to unlock this and the full Databases Mastery library.

What makes a good MongoDB shard key?

Next Step

Continue to Your MongoDB write throughput is saturating a single primary. How do you scale?← Back to all NoSQL questions