Basically, I have the same question with this post: How to get the last N records in mongodb?
I saw the solution using sort()
but would it be inefficient because it requires loading all of the data into memory, which can be slow and resource-intensive?
Would there be another way to solve this without having to use sort()
?