Share via


IChangeFeedDocumentClient.CreateDocumentAsync Method

Definition

Creates a Document as an asychronous operation in the Azure DocumentDB database service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.IResourceResponse<Microsoft.Azure.Documents.Document>> CreateDocumentAsync (string collectionLink, object document, Microsoft.Azure.Documents.Client.RequestOptions options = default, bool disableAutomaticIdGeneration = false, System.Threading.CancellationToken cancellationToken = default);
abstract member CreateDocumentAsync : string * obj * Microsoft.Azure.Documents.Client.RequestOptions * bool * System.Threading.CancellationToken -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.IResourceResponse<Microsoft.Azure.Documents.Document>>
Public Function CreateDocumentAsync (collectionLink As String, document As Object, Optional options As RequestOptions = Nothing, Optional disableAutomaticIdGeneration As Boolean = false, Optional cancellationToken As CancellationToken = Nothing) As Task(Of IResourceResponse(Of Document))

Parameters

collectionLink
String

The link of the DocumentCollection to create the document in. E.g. dbs/db_rid/colls/coll_rid/

document
Object

The document object to create.

options
RequestOptions

The RequestOptionsfor this request.

disableAutomaticIdGeneration
Boolean

Disables the automatic id generation, If this is True the system will throw an exception if the id property is missing from the Document.

cancellationToken
CancellationToken

A CancellationTokenthat can be used by other objects or threads to receive notice of cancellation.

Returns

A System.Threading.Tasks containing a IResourceResponse<TResource> which will contain information about the request issued.

Applies to