本文介绍了在CosmosDb中唯一定义RequestContinuation令牌的是什么的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在分页从CosmosDb返回的结果,为此,我需要了解唯一定义FeedOptions.RequestContinuation字符串的内容.我可以使分页工作,所以这不是问题,但是它的唯一性对于我们的目的是必需的.例如,令我惊讶的是,如果执行以下操作,RequestContinuation令牌将不相同:

I am going through paging the results returning from CosmosDb and for that I need to understand what uniquely defines the FeedOptions.RequestContinuation string.I can make the paging work, so that is not the issue, but its uniqueness is needed for our purposes. What astonished me, for instance, is that the RequestContinuation token is not the same if I perform the following:

-在模拟器中为两个pocos创建数据

-Create data in the emulator for two pocos

-使用MaxItemCount查询项目

-Query items with MaxItemCount

-获取第一个RequestContinuation令牌并将其存储

-Get the first RequestContinuation token and store it

-删除所有数据(手动在模拟器资源管理器中)并重新创建它们.数据完全相同,除了自动生成的值(例如Id

-Delete all data (manually in the emulator explorer) and recreating them. The data are exactly the same except for the auto-generated values such as the Id

-具有相同MaxItemCount的相同查询

-Same query with the same MaxItemCount

-再次获取令牌并将其存储

-Get the token again and store it

结果是最后检索到的令牌与第一种方法中的令牌不同.

The result is that the token last retrieved is not the same as the one in the first method.

是否可以详细解释唯一定义RequestContinuation令牌的内容?谢谢

Is it possible to have a detailed breakdown on what uniquely defines a RequestContinuation token?Thanks

推荐答案

继续标记应视为不透明字符串.实际值取决于查询执行计划,系统生成的ID,页面大小,并行度,API版本等配置,以及更多因素.但是,对于相同的查询,您不会两次获得相同的延续令牌.

The continuation token should be treated as an opaque string. The actual value depends on the query execution plan, system generated IDs, configurations like page size, degree of parallelism, API version, and more factors. You won't get the same continuation token twice for the same query however.

这篇关于在CosmosDb中唯一定义RequestContinuation令牌的是什么的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 18:36
查看更多