Add deprecation warning for sharding time series on timeField

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Developer Tools

      Starting in MongoDB 8.0, use of the timeField as a shard key in a time series collection is deprecated.

      Currently we only log the warning without giving any message in mongosh, could be possible to return a warning when sharding on timeField?

      Here an example of the log:

      sh.shardCollection(
       "test.weather",
       { "metadata.sensorId": 1,timestamp:1 },
       {
          timeseries: {
          timeField: "timestamp",
          metaField: "metadata",
          granularity: "hours"
       }
      
      {"t":{"$date":"2025-04-18T09:08:21.170+02:00"},"s":"W",  "c":"SHARDING", "id":8864700, "svc":"S", "ctx":"ShardingDDLCoordinator-2","msg":"Using timeField as a shard key in time-series collections is deprecated and will not be supported in future versions. Please reshard your collection using metaField as recommended in our time-series sharding documentation."}  

      cc nishith.atreya@mongodb.com

            Assignee:
            Unassigned
            Reporter:
            Renato Riccio
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: