Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.
So much depends upon the right choice of shard key. A poorly chosen shard key will prevent your application from taking advantage of many of the benefits provided by the sharded cluster. In the pathological case, both insert and query performance will be significantly impaired. Adding to the gravity of the decision is that once you’ve chosen a shard key, you’re stuck with it. Shard keys are immutable.[12]
[12] Note that there’s no good way to alter the shard key once you’ve created it. Your best bet is to create a new sharded collection with the proper key, export the data from the old sharded collection, and then restore the data to the new one.
Part of having a good experience with sharding is knowing what makes a good shard key. Because this isn’t immediately intuitive, I’ll start by describing the kinds of shard keys that don’t work well. This will naturally lead to a discussion of the ones that do.