Mongo Aggregation results not getting mapped after Spring Boot Upgrade

After upgrading from Spring boot 2.2.6.RELEASE to 2.4, the following mapping does not work & returns null for all the mapped values. I’m unable to find any mongo documentation describing any update to aggregation or mapping. However the rawResults contains the required data. I’ve tried changing the mongo versions, spring boot version upgrades.

The same code works without a issue in spring boot 2.2.6.RELEASE version.

   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();


1 Like