[SERVER-60641] Return better error message when trying to shard time series collection using hashed timefield Created: 13/Oct/21 Updated: 29/Oct/23 Resolved: 09/Jun/23 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | 7.1.0-rc0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Rushan Chen | Assignee: | Alice Li (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||||||
| Assigned Teams: |
Query Integration
|
||||||||||||||||
| Backwards Compatibility: | Fully Compatible | ||||||||||||||||
| Sprint: | QI 2023-06-12 | ||||||||||||||||
| Participants: | |||||||||||||||||
| Description |
|
db.runCommand({ create: "tscoll", timeseries:{timeField: 'time', metaField: 'id' }}) db.adminCommand({ shardCollection: "test.tscoll", key: { time: "hashed" }, numInitialChunks: 6 } ) ** returns { "ok" : 0, "errmsg" : "Invalid index spec for time-series collection: \{ time: \"hashed\" }. Indexes on the time field must be ascending or descen\ ding (numbers only): time: \"hashed\"", "code" : 2, "codeName" : "BadValue", "$clusterTime" : { "clusterTime" : Timestamp(1634110955, 1), "signature" : { "hash" : BinData(0,"AAAAAAAAAAAAAAAAAAAAAAAAAAA="), "keyId" : NumberLong(0) }
}, "operationTime" : Timestamp(1634110952, 1) }
Rather the user should be asked to shard the collection using range if the shard key happens to be the timeField. |
| Comments |
| Comment by Githook User [ 08/Jun/23 ] |
|
Author: {'name': 'Alice Li', 'email': 'alice.li@mongodb.com', 'username': ''}Message: |
| Comment by Ana Meza [ 05/Sep/22 ] |
|
Removing Sprint since this is assigned to QE backlog and neweng |
| Comment by Rushan Chen [ 06/Apr/22 ] |
|
returning this to backlog for new eng to pick up. |
| Comment by Kyle Suarez [ 22/Oct/21 ] |
|
The context of this is that the user would have to know that enabling sharding here implicitly creates an index on the time field. |