从Spring Boot 2.2.6.RELEASE升级到2.4后,以下映射不起作用&;为所有映射值返回NULL.我找不到任何描述聚合或 map 更新的mongo文档.但是,rawResults包含所需的数据.我试着更改了Mongo版本,升级了Spring Boot版本.
同样的代码在Spring Boot 2.2.6.RELEASE版本中运行正常.
final Aggregation agg = newAggregation(match(Criteria.where("id.cid").is(cId)),
group("sId.assignmentId", "status").count().as("total"),
sort(Sort.Direction.DESC, "sId.assignmentId", "status"));
final AggregationResults<StatusSummeryDTO> groupResults = mongoTemplate.aggregate(agg,
Submission.class, StatusSummeryDTO.class);
return groupResults.getMappedResults();