我试图用不区分大小写的选项对结果进行排序。这是我的代码:
List<AggregationOperation> operations = new ArrayList<>();
Sort.Order sort = ....ignoreCase();
operations.add(new SortOperation(new Sort(sort)));
但当我使用聚合执行查询时,它不起作用:
mongoOperations.aggregate(Aggregation.newAggregation(operations).withOptions(aggregationOptions)
我在调试控制台中显示了查询,ignoreCase在聚合中完全消失:
db.getCollection('persons').aggregate([
{
"$sort":{
"buyer.organization.name":-1
}
}
])
如何将“忽略大小写”选项放入聚合中?
谢谢你的帮助!