spring-data-mongodb
spring-data-mongodb copied to clipboard
Add support for collection expiration to @TimeSeries.
This will allow setting up automatic removal for time series collections (https://www.mongodb.com/docs/manual/core/timeseries/timeseries-automatic-removal/#set-up-automatic-removal-for-time-series-collections--ttl-), by adding an expireAfterSeconds
or expire
element to the @TimeSeries
annotation.
Similar to @Indexed
, expireAfterSeconds
on will have a default of -1
, and will not be used if it is <= 0. An error will be thrown if both expireAterSeconds
and expire
are defined. expire
allows all the same expressions as are supported on @Indexed
.
Closes #4099
- [x] You have read the Spring Data contribution guidelines.
- [x] You use the code formatters provided here and have them applied to your changes. Don’t submit any formatting related changes.
- [x] You submit test cases (unit or integration tests) that back your changes.
- [x] You added yourself as author in the headers of the classes you touched. Amend the date range in the Apache license header if needed. For new types, add the license header (copy from another file and set the current year only).
@bpfoster Please sign the Contributor License Agreement!
Click here to manually synchronize the status of this Pull Request.
See the FAQ for frequently asked questions.
@bpfoster Thank you for signing the Contributor License Agreement!
Thank you @bpfoster! To avoid the duplication in parsing the duration we're waiting for spring-projects/spring-framework#22474 to land in Framework 6 before bringing the changes in. Thanks for your understanding and patience.
Update - there's a PR (spring-projects/spring-framework#30396) targeting FW 6.1 timeframe.