Query for document with least value

Hi,
How can I write a query such that I get the document with the least value of a particular field?
For ex: I have a "marks" field. how do I get the document having the least value of marks

Now if I extend the same thing how can I get the doc which was first created (least value of date stamp)...

Thanks

you can use aggregation

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.