In native MongoDb behavior, the result of an Aggregation Grouping operation is a composite document id consisting of the fields grouped on. Prior to Spring Data Mongo 3.x, the spring mapping layer would disassemble the composite id produced by grouping, and automatically map each portion of the composite id to its original field.
2.x :
Aggregation.group( FieldOne, FieldTwo, FieldThree ) --> Document { _id: null, FieldOne: X, FieldTwo: Y, FieldThree: Z }
3.x :
Aggregation.group( FieldOne, FieldTwo, FieldThree ) --> Document { _id: [FieldOne: X, FieldTwo: Y, FieldThree: Z], FieldOne: null, FieldTwo: null, FieldThree: null }
https://jira.spring.io/browse/DATAMONGO-2437
Has anyone found an elegant way to simulate the old behavior of Spring Data MongoDb 2.x? I am working on a project with a large number of Mongo Collections and Spring Data Mongo Aggregations, and I would prefer not to heavily modify them all or write custom spring converters for each.