spring-data-cosmosdb icon indicating copy to clipboard operation
spring-data-cosmosdb copied to clipboard

Springboot CosmosRepository with continuation token

Open rannoune opened this issue 4 years ago • 1 comments

We are building an API with pagination and continuation token, so that our consumer can use the continuation token for the next call. We are using CosmosRepository with spring. This is the dependency we are using:

<dependency>
    <groupId>com.azure.spring</groupId>
    <artifactId>azure-spring-boot-starter-cosmos</artifactId>
    <version>3.1.0</version>
</dependency>

CosmosRepository code: com.azure.core.http.rest.Page<MyObject> findAllBy....(..., CosmosPageRequest request)

The above code is throwing an exception: com.azure.spring.data.cosmos.exception.CosmosAccessException: Too many results - return type interface com.azure.core.http.rest.Page is not of type Iterable but find returned 2 results] with root cause

If we use the spring Page in the return, then we won't be able to get the continuationToken

Can you please tell us how to implement Pagination with CosmosRepository and continuation token?

rannoune avatar Feb 23 '21 00:02 rannoune

Hi, @kushagraThapar and @mbhaskar could you help to take a look of this issue? Thanks~

yiliuTo avatar Feb 24 '21 02:02 yiliuTo