How to use dateAsFormattedString in Spring Data MongoDB

We want to reproduce the MongoDB query below db.presence.aggregate( [ { '$group' : { '_id' : { 'date' : { $dateToString: { format: '%d-%m-%Y', date: '$date'}}, 'sensorId' : '$sensorId', }, count: { $sum: 1 } } } ]); How can I use the function $dateToString in Spring Data ? Let&rsquo;s say we have a collection presence with documents defined as below. @Document(collection = 'presence') public class…