Azure CosmosDB连续令牌结构 [英] Azure CosmosDB Continuation Token Structure

查看:73
本文介绍了Azure CosmosDB连续令牌结构的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我阅读了很多有关CosmosDB分页的文档,并认为令牌应该看起来像这样:

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

{\令牌\":\"xxxxxx \",\范围\":{\最小\":\"xxxxxxxxxx \",\最大\":\"xxxxxxxxxx \"}}}

但是我得到的令牌看起来像这样:

But I got a token looks like this:

[{\"compositeToken \":{\令牌\":\"xxxxxxxxx \",\范围\":{\最小\":\"\",\最大\":\"05C1B9CD673390 \}},\" orderByItems \:[{\" item \:24}],\" rid \:\" duJVAIns + 3N6AAAAAAAAAA == \,\" skipCount \:0,\" filter \:null}]

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

我想知道令牌在什么情况下会具有compositeToken?

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

推荐答案

这并不是对您的问题的真正答案,但您不应尝试基于延续令牌的结构来构建逻辑.不久前,我也有同样的疑问,并要求Cosmos DB团队提供相同的解释.

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.

这篇关于Azure CosmosDB连续令牌结构的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆