When a collection with a non-default collation is sharded the chunks are arranged, migrated and targeted using the simple collation. This can mean that two documents that have identical shard keys according to the collation can live on different shards. For example, when using a case-insensitive collation, the chunk containing the shard key "abc" can live on a different shard than the chunk containing the shard key "ABC" - even though these two documents might be considered equal when using the case-insensitive collation. This means that the combination of shardKey and _id is not unique, since there is nothing to enforce that a document with shard key "ABC" has a different _id than the document with shard key "abc".
See the attached repro.js for an example of the impact of this - a non-multi write will update two documents.
- duplicates
-
SERVER-30970 Don't allow single-updates that aren't targetted on the shard key
- Backlog