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.@Nullable String@Nullable SpangetSpan()Get the span that defines a bucket.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.Select the time between timestamps in the same bucket to define how data in the time series collection is organized.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
@Contract("_ -> new") public CollectionOptions.TimeSeriesOptions metaField(@Nullable String 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- use null to unset.- Returns:
- new instance of
CollectionOptions.TimeSeriesOptions.
-
granularity
@Contract("_ -> new") public CollectionOptions.TimeSeriesOptions granularity(GranularityDefinition 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:
-
span
Select the time between timestamps in the same bucket to define how data in the time series collection is organized. Cannot be used in conjunction withgranularity(GranularityDefinition).- Parameters:
span- use null to unset.- Returns:
- new instance of
CollectionOptions.TimeSeriesOptions. - Since:
- 5.0
- 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:
-
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
-
getSpan
Get the span that defines a bucket.- Returns:
- null if not specified.
- Since:
- 5.0
-
toString
-
equals
-
hashCode
-