Quantcast
Channel: Azure Change Feed and Querying based on Partition - Stack Overflow
Viewing all articles
Browse latest Browse all 2

Azure Change Feed and Querying based on Partition

$
0
0

When we fetch data from Document Db in the change feed, we only want it per partition and have tried adding PatitionKey to the code.

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);

It returns single range and when we go perform the second query

IDocumentQuery<Document> query = client.CreateDocumentChangeFeedQuery(
                collectionUri,
                new ChangeFeedOptions
                {
                    PartitionKeyRangeId = pkRange.Id,
                    StartFromBeginning = true,
                    RequestContinuation = continuation,
                    MaxItemCount = -1,
                });

It returns all the results from all partitions. Is there a way to restrict the results from single partition only?


Viewing all articles
Browse latest Browse all 2

Latest Images

Trending Articles





Latest Images