MongoDB native query with pagination on aggregate: empty-results for subsequent runs

Description

When we use a MongoDB native query with pagination on aggregate,
the first use return a valid result set, while later uses will return an "unexpected empty" result list.

The problem it is described here: https://stackoverflow.com/questions/48994715.
It is reproduced with a test on attach : MongoDBNativeQueryPaginationTest.java

The reason we didn't spot this exception is a lack of unit tests, we should make sure to cover some of the basic use cases for pagination in core so that we can run them for the other dialects as well

Environment

None
Fixed

Assignee

Fabio Massimo Ercoli

Reporter

Fabio Massimo Ercoli

Labels

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Suitable for new contributors

None

backportDecision

None

backportReEvaluate

None

Components

Fix versions

Priority

Major
Configure