I need to skip a number of documents (offset
) from a query, and only return limit
number of documents that go after. I know the following naive approach:
collection.find(BSONDocument())
.cursor[T].collect[List](offset+limit).map(_.drop(offset))
but it is not really desired because it will load offset+limit
number of documents in JVM memory, whereas I'd like to filter them on the "database" side.