Spring data mongodb – The ‘cursor’ option is required

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.

Leave a Comment