SERVER-42390 allowed users to insert documents that are missing shard key fields and unset shard key fields through an update. An upsert that doesn't match an existing document takes a different code path than other updates, which currently incorrectly will reject a write that would result in a document without a shard key field because of this check. Instead, the upsert path should only assert the shard key paths do not contain arrays and that _id is present and does not contain an array.
Note that mongos will still require an upsert to have all shard key fields. This ticket allows upserts where the query portion has the full shard key but the update causes the document to end up missing shard key fields to succeed. Two ways this can happen are if theĀ replacement doc is missing shard key fields or the update unsets shard key fields.
- is related to
-
SERVER-42390 Allow documents in a sharded collection to not contain all shard key fields
- Closed