2 / 2
Jul 2024

Hi all,
I am using timeseries collection to store sensor data defined/create as below

database.CreateCollection("SensorData", new CreateCollectionOptions { TimeSeriesOptions = new TimeSeriesOptions("Timestamp", metaField: "SensorId", granularity: TimeSeriesGranularity.Seconds), ExpireAfter = TimeSpan.FromDays(365) }); ` As per the above syntax am expecting the document in the collection to be deleted after one year they were created. Now due to certain requirements I want to change ExpireAfter to 2 years. how can I achieve this functionality in C#. Any help will be appreciated .
2 months later

I’m trying to find help for same problem but I’m using mongocxx.
This is really frustrating.

Only solution I have come up is to create new collection and copy everything from the old one.