I have a bunch of records and I need to get latest (most recent) and the oldest (least recent).
When googling I found this topic where I saw
We have method called sort using that we can able to get first element(old document) which means 1 for sort field or last element(new document) which means -1 for sort field of collection.