Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 4115

Fetch Record from MongoDB in descending order?

$
0
0

Not able to sort the documents in descending order on last updated time stamp if the documents having the January and February records. how to get the documents in descending order

Query query= new Query();query.addCriteria(first name).with(Sort.By(Sort.Direction.DESC, lastUpdatedDateTime));

Tried with below query in springboot application

Query query= new Query();query.addCriteria(first name).with(Sort.By(Sort.Direction.DESC, lastUpdatedDateTime));MongoTemplate.find(query, Students list.class, STUDENT_COLLECTION);

Expect the latest records updated from students collection in descending order like first February records then January records


Viewing all articles
Browse latest Browse all 4115

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>