0
votes

when I tried to fetch the records from cosmos DB with offset value more than 100 using azure API, it returns an empty list though there are values. when using the generated query from code with the portal it returning the proper results.

The generated query from code: SELECT o.id from order o where o.versionId =1 AND o.resource.customer.id ='someid' order by o.resource.createdOn desc offset 100 limit 100

1
which SDK version are you using? OFFSET/LIMIT was added about a year ago and older clients might see strange behaviorsChris Anderson-MSFT
Do the skip and top in this post meet your needs?Jason Pan

1 Answers

0
votes

Thanks for your response.

The issue is fixed by adding the maxItemCount(value) to FeedOptions.

example:

FeedOptions options = new FeedOptions();
options.maxItemCount(1000);
FeedResponse<Document> feedResponse = documentClient
                .queryDocuments(String.format("collectionLink", databaseId, collectionName), query, options)