Here, as you can see the the documents gets swapped in different stages if the time is same due to which I get duplicate values in when I query for pagination.
To get documents in a specific order you must $sort.
You need a tie breaker field with unique values as the last field in case you have multiple documents with the same values for the sorted fields. Most of the time adding _id:1 as the last field work as the tie breaker.
Thank you @steevej for the reply. you are right and it worked.
1 Like
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.