If you need to retrieve large sets of data from the LRW then you need to use a specific paging technique.
The basic approach is as follows:
Sort on the _id value (xAPI - not statement.id!) or id (UDD) which is incremental in Mongo. On every limited batch you receive, take the last _id you receive and construct your next query to select all statements where _id is greater than that _id value.
Note also there is a limit to the number of records returned in one batch for aggregation queries. To override this for this add:
Note this is in addition to the $limit value in a pipeline query.