DocumentClient.ReplaceDocumentAsync Method

Definition

Overloads

ReplaceDocumentAsync(Document, RequestOptions)

Replaces a Document in the Azure DocumentDB database service as an asynchronous operation.

ReplaceDocumentAsync(String, Object, RequestOptions)

Replaces a Document in the Azure DocumentDB database service as an asynchronous operation.

ReplaceDocumentAsync(Uri, Object, RequestOptions)

Replaces a document as an asynchronous operation in the Azure DocumentDB database service.

ReplaceDocumentAsync(Document, RequestOptions)

Replaces a Document in the Azure DocumentDB database service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Document>> ReplaceDocumentAsync (Microsoft.Azure.Documents.Document document, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
document
Document

The updated Document to replace the existing resource with.

options
RequestOptions

(Optional) The request options for the request.

Returns

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

Exceptions

If document is not set.

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
404NotFound - This means the resource you tried to delete did not exist.

ReplaceDocumentAsync(String, Object, RequestOptions)

Replaces a Document in the Azure DocumentDB database service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Document>> ReplaceDocumentAsync (string documentLink, object document, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
documentLink
String

The link of the document to be updated. E.g. dbs/db_rid/colls/col_rid/docs/doc_rid/

document
Object

The updated Document to replace the existing resource with.

options
RequestOptions

(Optional) The request options for the request.

Returns

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

Exceptions

If either documentLink or document is not set.

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
404NotFound - This means the resource you tried to delete did not exist.

ReplaceDocumentAsync(Uri, Object, RequestOptions)

Replaces a document as an asynchronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Document>> ReplaceDocumentAsync (Uri documentUri, object document, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
documentUri
Uri

the URI of the document to be updated.

document
Object

the updated document.

options
RequestOptions

The request options for the request.

Returns

The task object representing the service response for the asynchronous operation.