Azure CosmosDB Continuation Token Structure

匆匆过客 提交于 2019-12-11 13:05:24

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/51867914/azure-cosmosdb-continuation-token-structure

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!