Mongodb 6.0.2 - Time Series sharding

Hi,
i’m using a docker container with mongodb image 6.0.2 (Docker hub)
i configured successfull the sharding with 2 shards, and 3 replicas per shard.

The sharding is working properly on the normal collections, but when i try to shard a timeseries collections, i got this error:

the command i’m using is the following:

sh.shardCollection(
   "test.weather",
   { "metadata.sensorId": 1 },
   {
      timeseries: {
         timeField: "timestamp",
         metaField: "metadata",
         granularity: "hours"
      }
   }
)

How can i solve this problem? looking at the documentation, this feature is avaiable since 5.1.

Thanks

Welcome to the MongoDB Community @Andrei_Goncear !

Was this a fresh installation of MongoDB server or were you upgrading from an earlier version?

Can you check the version of the MongoDB deployment you are connected to using the MongoDB shell:

db.version()

… and the featureCompatibilityVersion (fCV):

db.adminCommand({
	getParameter: 1,
	featureCompatibilityVersion: 1
})

As you noted, Sharding a Time Series Collection is supported in MongoDB 5.1+. Both of the above commands should report a 6.0 server version.

Regards,
Stennie

1 Like

Thank you! This was the solution:


before i had this version, then upgrading with:

db.adminCommand( { setFeatureCompatibilityVersion: "6.0" } )

has worked like a charm!
Thank you a lot

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.