Condividi tramite


IDocumentClient.ReadPartitionKeyRangeFeedAsync Method

Definition

Overloads

ReadPartitionKeyRangeFeedAsync(String, FeedOptions)

Reads the feed (sequence) of PartitionKeyRange for a database account from the Azure Cosmos DB service as an asynchronous operation.

ReadPartitionKeyRangeFeedAsync(Uri, FeedOptions)

Reads the feed (sequence) of PartitionKeyRange for a database account from the Azure Cosmos DB service as an asynchronous operation.

ReadPartitionKeyRangeFeedAsync(String, FeedOptions)

Reads the feed (sequence) of PartitionKeyRange for a database account from the Azure Cosmos DB service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.PartitionKeyRange>> ReadPartitionKeyRangeFeedAsync (string partitionKeyRangesOrCollectionLink, Microsoft.Azure.Documents.Client.FeedOptions options = default);
abstract member ReadPartitionKeyRangeFeedAsync : string * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.PartitionKeyRange>>
Public Function ReadPartitionKeyRangeFeedAsync (partitionKeyRangesOrCollectionLink As String, Optional options As FeedOptions = Nothing) As Task(Of FeedResponse(Of PartitionKeyRange))

Parameters

partitionKeyRangesOrCollectionLink
String

The link of the resources to be read, or owner collection link, SelfLink or AltLink. E.g. /dbs/db_rid/colls/coll_rid/pkranges

options
FeedOptions

(Optional) The request options for the request.

Returns

A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a Database containing the read resource record.

Exceptions

This exception can encapsulate many different types of errors. To determine the specific error always look at the StatusCode property. Some common codes you may get when creating a Document are:

StatusCodeReason for exception
429TooManyRequests - This means you have exceeded the number of request units per second. Consult the DocumentClientException.RetryAfter value to see how long you should wait before retrying this operation.

Examples

FeedResponse<PartitionKeyRange> response = null;
List<string> ids = new List<string>();
do
{
    response = await client.ReadPartitionKeyRangeFeedAsync(collection.SelfLink, new FeedOptions { MaxItemCount = 1000 });
    foreach (var item in response)
    {
        ids.Add(item.Id);
    }
}
while (!string.IsNullOrEmpty(response.ResponseContinuation));

See also

Applies to

ReadPartitionKeyRangeFeedAsync(Uri, FeedOptions)

Reads the feed (sequence) of PartitionKeyRange for a database account from the Azure Cosmos DB service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.PartitionKeyRange>> ReadPartitionKeyRangeFeedAsync (Uri partitionKeyRangesOrCollectionUri, Microsoft.Azure.Documents.Client.FeedOptions options = default);
abstract member ReadPartitionKeyRangeFeedAsync : Uri * Microsoft.Azure.Documents.Client.FeedOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.FeedResponse<Microsoft.Azure.Documents.PartitionKeyRange>>
Public Function ReadPartitionKeyRangeFeedAsync (partitionKeyRangesOrCollectionUri As Uri, Optional options As FeedOptions = Nothing) As Task(Of FeedResponse(Of PartitionKeyRange))

Parameters

partitionKeyRangesOrCollectionUri
Uri

The Uri for partition key ranges, or owner collection.

options
FeedOptions

(Optional) The request options for the request.

Returns

A System.Threading.Tasks containing a ResourceResponse<TResource> which wraps a PartitionKeyRange containing the read resource record.

Examples

Uri partitionKeyRangesUri = UriFactory.CreatePartitionKeyRangesUri(database.Id, collection.Id);
FeedResponse<PartitionKeyRange> response = null;
List<string> ids = new List<string>();
do
{
    response = await client.ReadPartitionKeyRangeFeedAsync(partitionKeyRangesUri, new FeedOptions { MaxItemCount = 1000 });
    foreach (var item in response)
    {
        ids.Add(item.Id);
    }
}
while (!string.IsNullOrEmpty(response.ResponseContinuation));

See also

Applies to