-
Type: Bug
-
Resolution: Duplicate
-
Priority: Major - P3
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
ALL
As https://docs.mongodb.com/manual/core/gridfs/#sharding-gridfs
says chunks sharding key should be files_id but it's an objectid and changes monotonically.
As https://docs.mongodb.com/manual/reference/limits/#Monotonically-Increasing-Shard-Keys-Can-Limit-Insert-Throughput
says
```
For clusters with high insert volumes, a shard keys with monotonically increasing and decreasing keys can affect insert throughput. If your shard key is the _id field, be aware that the default values of the _id fields are ObjectIds which have generally increasing values.
```
So the choice of files_id will lead to the write of gridfs chunks always happens on a single shard.
It's really a big problem because if someone use gridfs it always means there will be a lot of files data to store and need sharding.
- duplicates
-
SERVER-10220 Support hashed fields in compound indexes and compound shard keys
- Closed