DocumentClient.CreateDocumentCollectionAsync
Method
Definition
Overloads
| CreateDocumentCollectionAsync(String, DocumentCollection, RequestOptions) |
Creates a collection as an asychronous operation in the Azure DocumentDB database service. |
| CreateDocumentCollectionAsync(Uri, DocumentCollection, RequestOptions) |
Creates a collection as an asychronous operation in the Azure DocumentDB database service. |
CreateDocumentCollectionAsync(String, DocumentCollection, RequestOptions)
Creates a collection as an asychronous operation in the Azure DocumentDB database service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>> CreateDocumentCollectionAsync (string databaseLink, Microsoft.Azure.Documents.DocumentCollection documentCollection, Microsoft.Azure.Documents.Client.RequestOptions options = null);
- databaseLink
- String
The link of the database to create the collection in. E.g. dbs/db_rid/.
- documentCollection
- DocumentCollection
The DocumentCollection object.
- options
- RequestOptions
(Optional) Any RequestOptions you wish to provide when creating a Collection. E.g. RequestOptions.OfferThroughput = 400.
The DocumentCollection that was created contained within a Task object representing the service response for the asynchronous operation.
If either databaseLink or documentCollection 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 collection are:
| StatusCode | Reason for exception |
|---|---|
| 400 | BadRequest - This means something was wrong with the request supplied. It is likely that an id was not supplied for the new collection. |
| 403 | Forbidden - This means you attempted to exceed your quota for collections. Contact support to have this quota increased. |
| 409 | Conflict - This means a DocumentCollection with an id matching the id you supplied already existed. |
CreateDocumentCollectionAsync(Uri, DocumentCollection, RequestOptions)
Creates a collection as an asychronous operation in the Azure DocumentDB database service.
public System.Threading.Tasks.Task<Microsoft.Azure.Documents.Client.ResourceResponse<Microsoft.Azure.Documents.DocumentCollection>> CreateDocumentCollectionAsync (Uri databaseUri, Microsoft.Azure.Documents.DocumentCollection documentCollection, Microsoft.Azure.Documents.Client.RequestOptions options = null);
- databaseUri
- Uri
the URI of the database to create the collection in.
- documentCollection
- DocumentCollection
the Microsoft.Azure.Documents.DocumentCollection object.
- options
- RequestOptions
The request options for the request.
The task object representing the service response for the asynchronous operation.