高版本3.6导致聚合操作失败
报错如下
The 'cursor' option is required, except for aggregate with the explain argument
解决办法:
1,升级spring 版本
upgrade your Spring Data MongoDB dependency to 1.10.10.RELEASE
upgrade your spring-boot-starter-data-mongodb dependency to 1.5.10.RELEASE
2,修改AggregationOptions构造方式
原本方式
Cursor cursor = mongoTemplate.getCollection(collection).aggregate(pipeLine, AggregationOptions.builder().build());
修改后
Cursor cursor = mongoTemplate.getCollection(collection).aggregate(pipeLine,AggregationOptions.builder().outputMode(AggregationOptions.OutputMode.CURSOR).build());