I need to implement aggregation in Spring-Data MongoDB.
This aggregation $group
works successfully in Mongo Compass:
$group{
{
_id: { $dateToString: { format: "%Y-%m-%d", date: "$date" }},
doc: {"$push":"$$ROOT"}
}
}
This is the result expected group by year month and day and push results with all field in array docs
I try to implement this aggregation Spring Mongo:
My problem is that lose data and only get a date by the previous projection.
I prefer not use the $project
and only $group
stage.