One Star

[resolved] How to find max value of a field in mongoDB?

Hi,
I want to find max value of a field total_marks in mongoDB. How to do it?
MongoDB equivalent of: select max(total_marks) from table;
Can it be done using tMongoDBInput component? 
2 REPLIES
Four Stars

Re: [resolved] How to find max value of a field in mongoDB?

In order to have max, you need to use groupby clause in your sql query..., you can get the max value for specific column without using talend components...
- in talend you have tAggregatexxx component(s) which can also give you max value based on the aggregate column...
what is the problem you are facing and what is your current design?
vaibhav
One Star

Re: [resolved] How to find max value of a field in mongoDB?

HI vaibhav.
MongoDb is a no-Sql database. So was not able to figure out how to find the max value.
But i figured out that i can sort the input recieved and limit no of records to 1 to get what i needed.
Thanks!