List all documents from mongodb where the each document's one field has max value in spring boot

I have list of documents on mongodb like

Id, name, surname, salary. 

I want all documents would return which contains max salary. I know that i should aggregate the query in two step.

  1. First of all, I should find max value of salar field for all documents,
  2. and after then i should find all documents where salary equals maxValue.

But i cannot configure it neither JPA nor native query approach. How can i make it happen?



Comments

Popular posts from this blog

I get wrong characters when retreiving the message body of an email using TIdIMAP4.UIDRetrieveTextPeek2()

How to drop the all the 1's in a correlation matrix

Today Walkin 14th-Sept