Annotation Interface TimeSeries
Identifies a domain object to be persisted to a MongoDB Time Series collection.
- Since:
- 3.3
- Author:
- Christoph Strobl, Ben Foster
- See Also:
-
Required Element Summary
Required Elements -
Optional Element Summary
Optional ElementsModifier and TypeOptional ElementDescriptionDefines the collation to apply when executing a query or creating indexes.The collection the document representing the entity is supposed to be stored in.Configure the timeout after which the document should expire.Select thegranularity
parameter to define how data in the time series collection is organized.The name of the field which contains metadata in each time series document.
-
Element Details
-
timeField
String timeFieldName of the property which contains the date in each time series document.
Translation of property names toannotated fieldnames
will be considered during the mapping process.- Returns:
- never null.
-
-
-
collection
The collection the document representing the entity is supposed to be stored in. If not configured, a default collection name will be derived from the type's name. The attribute supports SpEL expressions to dynamically calculate the collection based on a per operation basis.- Returns:
- the name of the collection to be used.
- See Also:
- Default:
- ""
-
metaField
String metaFieldThe name of the field which contains metadata in each time series document. Should not be the id nortimeField()
nor point to an array orCollection
.
Translation of property names toannotated fieldnames
will be considered during the mapping process.- Returns:
- empty
String
by default.
- Default:
- ""
-
granularity
Granularity granularitySelect thegranularity
parameter to define how data in the time series collection is organized.- Returns:
server default
by default.
- Default:
- DEFAULT
-
collation
Defines the collation to apply when executing a query or creating indexes.- Returns:
- an empty
String
by default. - See Also:
- Default:
- ""
-
expireAfter
String expireAfterConfigure the timeout after which the document should expire. Defaults to an emptyString
for no expiry. Accepts numeric values followed by their unit of measure:- d: Days
- h: Hours
- m: Minutes
- s: Seconds
- Alternatively: A Spring template expression. The expression can result in a
Duration
or a valid expirationString
according to the already mentioned conventions.
@TimeSeries(expireAfter = "10s") String expireAfterTenSeconds; @TimeSeries(expireAfter = "1d") String expireAfterOneDay; @TimeSeries(expireAfter = "P2D") String expireAfterTwoDays; @TimeSeries(expireAfter = "#{@mySpringBean.timeout}") String expireAfterTimeoutObtainedFromSpringBean; @TimeSeries(expireAfter = "${my.property.timeout}") String expireAfterTimeoutObtainedFromProperty;
- Returns:
- empty by default.
- Since:
- 4.4
- Default:
- ""
-