【发布时间】:2017-06-29 15:50:57
【问题描述】:
当我们从更改提要中的 Document Db 获取数据时,我们只希望每个分区都得到它,并尝试将 PatitionKey 添加到代码中。
do
{
FeedResponse<PartitionKeyRange> pkRangesResponse = await client.ReadPartitionKeyRangeFeedAsync(
collectionUri,
new FeedOptions
{
RequestContinuation = pkRangesResponseContinuation,
PartitionKey = new PartitionKey("KEY"),
});
partitionKeyRanges.AddRange(pkRangesResponse);
pkRangesResponseContinuation = pkRangesResponse.ResponseContinuation;
}
while (pkRangesResponseContinuation != null);
它返回单个范围,当我们去执行第二个查询时
IDocumentQuery<Document> query = client.CreateDocumentChangeFeedQuery(
collectionUri,
new ChangeFeedOptions
{
PartitionKeyRangeId = pkRange.Id,
StartFromBeginning = true,
RequestContinuation = continuation,
MaxItemCount = -1,
});
它返回所有分区的所有结果。有没有办法只限制单个分区的结果?
【问题讨论】:
-
根据artilce,CreateDocumentChangeFeedQuery 方法会从一个分区范围内获取结果,我们不能只限制单个分区的结果。
-
那么根据该建议,更改提要只能通过中间服务器支持,而不能直接由客户端支持?由于客户端可能无法访问其他分区数据?
-
在我看来,中间服务器也是客户端。更改源用于存储对 Azure Cosmos DB 数据所做的更改。 azure documentdb 服务器只支持分区范围跟踪。所以我们只能使用分区范围。
标签: azure azure-cosmosdb