I'm in the learning phase of mongodb.
I have a test website project where each step of a story is a domain.com/step for instance, step 14 is accessed through domain.com/14
In other words, for the above case, I will need to access 14th document in my collection to serve it.
I've been using find().skip(n).limit(1)
method for this so far to return n
th document however it becomes extremely slow when there are too many documents to skip. So I need a more efficient way to get the n
th document in my collection.
Any ideas are appreciated.