Module spring.data.mongodb
Class CollectionOptions.TimeSeriesOptions
java.lang.Object
org.springframework.data.mongodb.core.CollectionOptions.TimeSeriesOptions
- Enclosing class:
- CollectionOptions
Options applicable to Time Series collections.
- Since:
- 3.3
- Author:
- Christoph Strobl
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionbooleanexpireAfter(Duration ttl) Set theDurationfor automatic removal of documents older than a specified value.Get theDurationfor automatic removal of documents.granularity(GranularityDefinition granularity) Select theGranularityDefinitionparameter to define how data in the time series collection is organized.inthashCode()Set the name of the field which contains metadata in each time series document.timeSeries(String timeField) Create a new instance ofCollectionOptions.TimeSeriesOptionsusing the given field as its timeField.toString()
-
Method Details
-
timeSeries
Create a new instance ofCollectionOptions.TimeSeriesOptionsusing the given field as its timeField. The one, that contains the date in each time series document.
Annotated fieldnameswill be considered during the mapping process.- Parameters:
timeField- must not be null.- Returns:
- new instance of
CollectionOptions.TimeSeriesOptions.
-
metaField
Set the name of the field which contains metadata in each time series document. Should not be the id nortimeSeries(String)timeField} nor point to an array orCollection.
Annotated fieldnameswill be considered during the mapping process.- Parameters:
metaField- must not be null.- Returns:
- new instance of
CollectionOptions.TimeSeriesOptions.
-
granularity
Select theGranularityDefinitionparameter to define how data in the time series collection is organized. Select one that is closest to the time span between incoming measurements.- Returns:
- new instance of
CollectionOptions.TimeSeriesOptions. - See Also:
-
expireAfter
Set theDurationfor automatic removal of documents older than a specified value.- Parameters:
ttl- must not be null.- Returns:
- new instance of
CollectionOptions.TimeSeriesOptions. - Since:
- 4.4
- See Also:
-
CreateCollectionOptions.expireAfter(long, java.util.concurrent.TimeUnit)
-
getTimeField
- Returns:
- never null.
-
getMetaField
- Returns:
- can be null. Might be an empty
Stringas well, so maybe check viaStringUtils.hasText(String).
-
getGranularity
- Returns:
- never null.
-
getExpireAfter
Get theDurationfor automatic removal of documents.- Returns:
- a
negativevalue if not specified. - Since:
- 4.4
-
toString
-
equals
-
hashCode
public int hashCode()
-