-
Type: Bug
-
Resolution: Works as Designed
-
Priority: Major - P3
-
None
-
Affects Version/s: 7.1.0-rc0, 7.0.0-rc1, 6.0.7, 5.0.19, 4.4.23
-
Component/s: None
-
None
-
ALL
While looking back on 10gen/mongo#12776 for SERVER-76948, I realized the field validation to allow DBRefs as shard keys may still be too strict.
That patch only allows "$ref", "$id", and "$db" fields explicitly. There are no restrictions on DBRefs containing additional fields thereafter, and those fields may be dollar-prefixed following 5.0 project to allow dots and dollars in field names (e.g. SERVER-49117). In the interest of backwards compatibility for users that may already be sharding on DBRefs containing additional dollar-prefixed fields, the validation in parseShardKeyPattern should be relaxed.
Beyond DBRefs, is there any reason a document like the following cannot be used as a shard key?
{ "$foo": 1 }
Looking back at SERVER-74124, it seems that the original intention was just to prohibit the special "$**" field name, so perhaps the validation can check for that explicitly.
Note for triage: I entered all of the "Fix Versions" from SERVER-76948 as the "Affects Version" for this ticket, but some of those are still unreleased. Please adjust accordingly.
- is related to
-
SERVER-74124 Disallow sharding with wildcard shard key pattern
- Closed
-
SERVER-76948 Allow shard key fields to contain DBRefs
- Closed