Share via


DocumentResponse<TDocument> Class

Definition

Represents the template class used by methods returning single objects in the Azure Cosmos DB service.

public sealed class DocumentResponse<TDocument> : Microsoft.Azure.Documents.Client.ResourceResponseBase, Microsoft.Azure.Documents.Client.IDocumentResponse<TDocument>
type DocumentResponse<'Document> = class
    inherit ResourceResponseBase
    interface IDocumentResponse<'Document>
    interface IResourceResponseBase
Public NotInheritable Class DocumentResponse(Of TDocument)
Inherits ResourceResponseBase
Implements IDocumentResponse(Of TDocument)

Type Parameters

TDocument

the document type.

Inheritance
DocumentResponse<TDocument>
Implements

Examples

The following example extracts the CustomerName property, request units consumed, activity ID and StatusCode from a ReadDocumentAsync{Customer} call.

DocumentResponse<Customer> response = await client.ReadDocumentAsync<Customer>(documentLink);
Console.WriteLine(response.Document.CustomerName);
Console.WriteLine(response.RequestCharge);
Console.WriteLine(response.ActivityId); 
Console.WriteLine(response.StatusCode); // HttpStatusCode.Created or 201

Remarks

Response from type-specific read of Document resource(ReadDocumentAsync{TDocument}) returns the response wrapped in a DocumentResponse object. This contains the metadata from the response headers from the Azure Cosmos DB call including the request units (RequestCharge), activity ID, quotas/usage of resources and the typed document object(TDocument).

Constructors

DocumentResponse<TDocument>()

Constructor exposed for mocking purposes for the Azure Cosmos DB service.

DocumentResponse<TDocument>(TDocument)

Constructor exposed for mocking purposes for the Azure Cosmos DB service.

Properties

ActivityId

Gets the activity ID for the request from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
CollectionQuota

Gets the maximum quota for collection resources within an account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
CollectionSizeQuota

Gets the maximum size of a collection in kilobytes from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
CollectionSizeUsage

Gets the current size of a collection in kilobytes from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
CollectionUsage

Gets the current number of collection resources within the account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
ContentLocation

The content parent location, for example, dbs/foo/colls/bar in the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
CurrentResourceQuotaUsage

Gets the current size of this entity from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
DatabaseQuota

Gets the maximum quota for database resources within the account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
DatabaseUsage

Gets the current number of database resources within the account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
Document

Gets the document returned in the response from the Azure Cosmos DB service.

DocumentQuota

Gets the maximum size of a documents within a collection in kilobytes from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
DocumentUsage

Gets the current size of documents within a collection in kilobytes from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
IndexTransformationProgress

Gets the progress of an index transformation, if one is underway from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
IsRUPerMinuteUsed

Gets the flag associated with the response from the Azure Cosmos DB service whether this request is served from Request Units(RUs)/minute capacity or not.

(Inherited from ResourceResponseBase)
LazyIndexingProgress

Gets the progress of lazy indexing from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
MaxResourceQuota

Gets the maximum size limit for this entity from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
PermissionQuota

Gets the maximum quota for permission resources within an account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
PermissionUsage

Gets the current number of permission resources within the account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
RequestCharge

Gets the request charge for this request from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
RequestDiagnosticsString

Gets the diagnostics information for the current request to Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
RequestLatency

Gets the end-to-end request latency for the current request to Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
ResponseHeaders

Gets the response headers from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
ResponseStream

Gets the underlying stream of the response from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
SessionToken

Gets the session token for use in sesssion consistency reads from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
StatusCode

Gets the HTTP status code associated with the response from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
StoredProceduresQuota

Gets the maximum quota of stored procedures for a collection from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
StoredProceduresUsage

Gets the current number of stored procedures for a collection from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
TriggersQuota

Gets the maximum quota of triggers for a collection from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
TriggersUsage

Gets the current number of triggers for a collection from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
UserDefinedFunctionsQuota

Gets the maximum quota of user defined functions for a collection from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
UserDefinedFunctionsUsage

Gets the current number of user defined functions for a collection from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
UserQuota

Gets the maximum quota for user resources within an account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)
UserUsage

Gets the current number of user resources within the account from the Azure Cosmos DB service.

(Inherited from ResourceResponseBase)

Operators

Implicit(DocumentResponse<TDocument> to TDocument)

Returns the document in the response implicitly from the Azure Cosmos DB service.

Applies to