DocumentClient.CreateDatabaseAsync
Method
Definition
Creates a database resource as an asychronous operation in the Azure DocumentDB database service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.Database>> CreateDatabaseAsync (Microsoft.Azure.Documents.Database database, Microsoft.Azure.Documents.Client.RequestOptions options = null);
Parameters
- options
- RequestOptions
(Optional) The RequestOptions for the request.
Returns
The Database that was created within a task object representing the service response for the asynchronous operation.
Exceptions
If database is not set.
Represents a consolidation of failures that occured during async processing. Look within InnerExceptions to find the actual exception(s).
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 Database are:
| StatusCode | Reason for exception |
|---|---|
| 400 | BadRequest - This means something was wrong with the database object supplied. It is likely that an id was not supplied for the new Database. |
| 409 | Conflict - This means a Database with an id matching the id field of database already existed. |