1

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 Conmpass

I try to implement this aggregation Spring Mongo:

My implementation

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.

My actual result

Valijon
  • 12,667
  • 4
  • 34
  • 67

0 Answers0