MongoDb cursor API how to?

When use this method with sort: %{<field>: <order>} option, it seems the sorting is not done in the entire result space but only on the returned batch, unless I set page = 0 and limit = <number of all items in DB>

E.g., say I have 10 items in DB labeled 1 --> 10. Say an unsorted query, with limit = 10, returns

[1, 3, 2, 4, 8, 5, 9, 7, 6, 10]

Now if I set limit = 5, and sort increasing order, then with page = 0, 1, the two returned batches are:

[1, 2, 3, 4, 8]

and

[5, 6, 7, 9, 10]

What I want are:

[1, 2, 3, 4, 5]

and

[6, 7, 8, 9, 10]

Could u pls show me the way to achieve that, if there is?

Thanks a lot!

1 Like