[SERVER-77255] Shard key field validation for DBRefs prohibits extra dollar-prefixed fields Created: 18/May/23 Updated: 27/Oct/23 Resolved: 18/May/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | 7.1.0-rc0, 7.0.0-rc1, 6.0.7, 5.0.19, 4.4.23 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jeremy Mikola | Assignee: | Unassigned |
| Resolution: | Works as Designed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Operating System: | ALL | ||||||||||||
| Participants: | |||||||||||||
| Description |
|
While looking back on 10gen/mongo#12776 for 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. Beyond DBRefs, is there any reason a document like the following cannot be used as a shard key?
Looking back at Note for triage: I entered all of the "Fix Versions" from |
| Comments |
| Comment by Jeremy Mikola [ 18/May/23 ] | ||||||||||||||||||||
|
cheahuychou.mao@mongodb.com followed up in 10gen/mongo#12776 and pointed out that the current shard key validation logic (as of This prompted me to go back and review the product description for "Mitigate pain of using field names with dots and dollars" project. It explicitly excluded "Indexing on fields with dots/dollar". This means that while indexes on the "$ref", "$id", and "$db" fields within a DBRef object are supported, the project did not introduce the ability to index other dollar-prefixed fields (be it in a DBRef or any other object). This answers the question I posed in the issue description:
Likewise, indexing on extra dollar-prefixed fields within a DBRef was never possible. I definitely misunderstood the issue being addressed by Verifying via the shell for my own benefit:
That all makes sense, so I think this issue can just be closed as "Works as Designed". Apologies for the noise. |