MongoDB get maximum value in Java
To get/find a maximum value from a collection in MongoDB is similar to getting a max value from a column in SQL.
Corresponding SQL query is similar to this
Consider a collection called loan created as below
Let's find out the loan category having maximum interest rate among the three inserted in the collection above:
This example above has 3 interest rates 12 - Home Loans, 14 - Personal Loans, 16 - Car Loans
To get the maximum loan value use below query
Java Example :