I am not deeply familiar with MongoDB aggregation mechanism but while trying to use the aggregate method implemented by mongo-cursor-pagination, I ran into troubles.
I could be wrong but it seems that the pagination mechanism works by getting one more element than the limit parameter passed by the user, and depending on the number of documents found, can guess if there is another page after. This particular mechanism is broken if you use a $group instruction inside your aggregation pipeline because the number of results is therefore changed.
Hi !
I am not deeply familiar with MongoDB aggregation mechanism but while trying to use the aggregate method implemented by
mongo-cursor-pagination
, I ran into troubles.I could be wrong but it seems that the pagination mechanism works by getting one more element than the
limit
parameter passed by the user, and depending on the number of documents found, can guess if there is another page after. This particular mechanism is broken if you use a$group
instruction inside your aggregation pipeline because the number of results is therefore changed.