I have the following Mongo database:
db.group:
{id: 1, name:"a"} // index == 1
{id: 2, name:"b"} // index == 2
{id: 13, name:"c"} // index == 3
{id: 14, name:"d"} // index == 4
{id: 51, name:"e"} // index == 5
{id: 52, name:"f"} // index == 6
{id: 61, name:"g"} // index == 7
{id: 88, name:"h"} // index == 8
I am implementing pagination and I'd like to return 3 documents, starting from the index 4 (1-based, not zero based), which would be
{id: 14, name:"d"} // index == 4
{id: 51, name:"e"} // index == 5
{id: 52, name:"f"} // index == 6
I know I can use .limit
to limit the number of records returned, but how do I say the limit
should start from the index 4?