microsoft / spring-data-cosmosdb

Access data with Azure Cosmos DB
MIT License
94 stars 64 forks source link

Pagination returns incorrect result for getTotalPages() and hasNext() APIs #452

Closed kushagraThapar closed 4 years ago

kushagraThapar commented 4 years ago

When using APIs with pagination, cosmosdb can return less number of documents than suggested pageSize. This leads to incorrect calculation of page.getTotalPages() and page.hasNext()

Fix: We need to implement PageImpl<> interface and calculate the offset, pageSize and totalPages manually for every iteration.