Spring data mongodb - The 'cursor' option is required
I was using:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath></relativePath>
</parent>
Then after upgraded my dependency to a higher version, the issue was resolved:
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.10.RELEASE</version>
<relativePath></relativePath>
</parent>
MongoDB changed in 3.6 how the aggregation command works. Aggregations require now a cursor. We adapted Spring Data MongoDB 2.1 but not previous versions.
Aggregations must be invoked through the collection's aggregate(…)
method instead of calling the command directly. This is also the reason why we didn't backport the change. executeCommand(…)
is no longer called and we don't want to break compatibility in a bugfix release.
The easiest approach for you can be to override the aggregate(…)
method and call the appropriate method, DBCollection.aggregate(…)
with the mapped aggregation pipeline.
It seems Pull Request mentionned by @mp911de has been release in version 1.10.10 of Spring Data MongoDB. So you can either
- upgrade your Spring Data MongoDB dependency to 1.10.10.RELEASE
- upgrade your spring-boot-starter-data-mongodb dependency to 1.5.10.RELEASE