我正在尝试在自定义的Spring存储库上使用Spring实现mongoTemplate聚合,并且我有这样的聚合:
final TypedAggregation aggregation = newAggregation(Result.class,
lookupOperation,
addFieldOperation,
unWindOperation,
groupOperation,
), "inputCollection", Result.class).getMappedResults();
我想添加Spring SortOperation sort()
并仅在条件有效时进行过滤。
有什么方法可以将AggregationOperation添加到aggregation
变量中?
我发现AggregationOptions cursor
将其他选项传递给聚合,但是找不到如何实例化排序的方法。有机会帮助我做到这一点吗?