superninja
superninja

Reputation: 3401

Azure CosmosDB Continuation Token Structure

I read a lot of the documentation regarding to CosmosDB paging and thought the token should look something like this:

{\"token\":\"xxxxxx\",\"range\":{\"min\":\"xxxxxxxxxx\",\"max\":\"xxxxxxxxxx\"}}

But I got a token looks like this:

[{\"compositeToken\":{\"token\":\"xxxxxxxxx\",\"range\":{\"min\":\"\",\"max\":\"05C1B9CD673390\"}},\"orderByItems\":[{\"item\":24}],\"rid\":\"duJVAIns+3N6AAAAAAAAAA==\",\"skipCount\":0,\"filter\":null}]

I was wondering in what scenario would the token has compositeToken?

Upvotes: 2

Views: 1089

Answers (1)

Gaurav Mantri
Gaurav Mantri

Reputation: 136196

Not really an answer to your question but you should not try to build logic based on the structure of continuation token. I had the same doubt some time ago and asked Cosmos DB team for an explanation for the same.

What I was told that continuation tokens should be treated as opaque i.e. you should not infer anything from the value of the continuation token and also not build any application logic around its value.

Only thing the application code should be concerned about is the presence or absence of the continuation token. If the continuation token is present, that means there is more data available matching your query and you should pass the continuation token as is along with your next request to fetch that next set of data. If the continuation token is not present, that means there isn't any more data matching your query.

Upvotes: 6

Related Questions