Stitch pagination

I’m building an API using Stitch. Using a simple GET request and obtaining a set of documents from the DB. See code below:

const docs ="mongodb-atlas")

I get an error using the line


stating that

"error": "TypeError: 'skip' is not a function",

Any ideas how I can implement pagination in this situation? or why this doesn’t work?

In order to use “skip” needed to use aggregate instead of find? see below…

const docs ="mongodb-atlas")
        {"$skip": 1},
        {"$limit": 9}

In my code I don’t use skip, because I read somewhere it is inefficient. Instead you can use find by _id and use limit. The second approach described in this article:

Hope it helps.

Here is the performance test: