Share via


IDocumentClient.DeleteDatabaseAsync Method

Definition

Overloads

DeleteDatabaseAsync(Uri, RequestOptions)

Delete a database as an asynchronous operation in the Azure Cosmos DB service.

DeleteDatabaseAsync(String, RequestOptions)

Delete a Database from the Azure Cosmos DB service as an asynchronous operation.

DeleteDatabaseAsync(Uri, RequestOptions)

Delete a database as an asynchronous operation in the Azure Cosmos DB service.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Database>> DeleteDatabaseAsync (Uri databaseUri, Microsoft.Azure.Documents.Client.RequestOptions options = default);
abstract member DeleteDatabaseAsync : Uri * Microsoft.Azure.Documents.Client.RequestOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Database>>
Public Function DeleteDatabaseAsync (databaseUri As Uri, Optional options As RequestOptions = Nothing) As Task(Of ResourceResponse(Of Database))

Parameters

databaseUri
Uri

The URI of the database to delete.

options
RequestOptions

(Optional) The RequestOptions for the request.

Returns

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

Applies to

DeleteDatabaseAsync(String, RequestOptions)

Delete a Database from the Azure Cosmos DB service as an asynchronous operation.

public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Database>> DeleteDatabaseAsync (string databaseLink, Microsoft.Azure.Documents.Client.RequestOptions options = default);
abstract member DeleteDatabaseAsync : string * Microsoft.Azure.Documents.Client.RequestOptions -> System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Database>>
Public Function DeleteDatabaseAsync (databaseLink As String, Optional options As RequestOptions = Nothing) As Task(Of ResourceResponse(Of Database))

Parameters

databaseLink
String

The link of the Database to delete. E.g. dbs/db_rid/

options
RequestOptions

(Optional) The request options for the request.

Returns

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

Exceptions

If databaseLink 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.

Examples

//Delete a database using its selfLink property
//To get the databaseLink you would have to query for the Database, using CreateDatabaseQuery(),  and then refer to its .SelfLink property
await client.DeleteDatabaseAsync(databaseLink);

See also

Applies to