Spring-boot mongoTemplate how to find entity with max value in mongoDB

Viewed 101

i have to find the max value in spring boot with mongoDB. Here is my sample code which i have tried and successfully executed in mongoDB console

db.ecle_audit_transaction.aggregate(
   [
     {
       $group:
         {
           _id: "$rootId",
            logMessageType: { $max: "$logMessageType" }
         }
     }
   ]
)

could you please help me how to write this query in spring bootmongoTemplate

0 Answers
Related