Support for MongoDB TimeSeries expireAfterSeconds #4099
Description
Hello 🙂
Spring-data-mongodb supports TimeSeries since version 3.3. It allows to declare and create new timeseries collection. The @TimeSeries annotation offers many parameters such as those which are in the sub-object timeseries, (timeField
, metaField
and granularity
). But there is no support for a field that comes with the TimeSeries arrival which is expireAfterSeconds
(time series collections).
Regarding the code the CollectionOptions
class, there is no field corresponding to expireAfterSeconds
. Then if we want to create a time series with automatic expiration period, we must bypass the Spring classes and annotations (that's sad 🙁).
Is a support for the expireAfterSeconds
planned for @TimeSeries
? If not, I suggest to add the option to @TimeSerie
annotation only. As mentionned in documentation:
expiredAfterSeconds
Optional. Enable the automatic deletion of documents in a time series collection by specifying the number of seconds after which documents expire. MongoDB deletes expired documents automatically.
(therefore, I don't understand why this option is not part of timeseries
sub-object...)
I hope this proposal will interest you
Regards