Issue
I'm looking at the latest spring data documentation for mongo and it states:
Create a Time Series Collection derived from an Annotation
@TimeSeries(collection="weather", timeField = "timestamp")
public class Measurement {
String id;
Instant timestamp;
// ...
}
template.createCollection(Measurement.class);
However, I don't see @TimeSeries in any of the spring annotations. What dependency are they using here? I'm using spring boot framework, is it possible they updated spring data but not spring boot data?
Solution
What worked is to mimic the instructions on the springframework documentation with the latest snapshots of the spring boot packages.
Add the snapshots repositories to any pom that references the snapshot versions.
... <repositories> <repository> <id>spring-snapshots</id> <url>https://repo.spring.io/snapshot</url> <snapshots><enabled>true</enabled></snapshots> </repository> <repository> <id>spring-milestones</id> <url>https://repo.spring.io/milestone</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-snapshots</id> <url>https://repo.spring.io/snapshot</url> </pluginRepository> <pluginRepository> <id>spring-milestones</id> <url>https://repo.spring.io/milestone</url> </pluginRepository> </pluginRepositories>
Set the spring boot version, currently:
<spring.boot.version>2.6.0-SNAPSHOT</spring.boot.version>
Set the spring boot starter data mongodb version, currently:
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-mongodb</artifactId> <version>2.5.3</version> </dependency>
Edit - if you're using Spring Cloud, your application will throw compatibility errors between the SNAPSHOT and Spring Cloud at run time unless you update your yaml config files with the following:
spring:
cloud:
compatibility-verifier:
enabled: false
Answered By - Arlo Guthrie