Database Class
Updated: June 30, 2017
Represents a database in the Azure DocumentDB account.
Assembly: Microsoft.Azure.Documents.Client (in Microsoft.Azure.Documents.Client.dll)
Microsoft.Azure.DocumentsJsonSerializable
Microsoft.Azure.DocumentsResource
Microsoft.Azure.DocumentsDatabase
| Name | Description | |
|---|---|---|
![]() | Database | Initializes a new instance of the Database class for the Azure DocumentDB database service. |
| Name | Description | |
|---|---|---|
![]() | Gets the alt-link associated with the resource from the Azure DocumentDB database service. (Inherited from Resource.) | |
![]() | Gets the self-link for collections from the Azure DocumentDB database service. | |
![]() | Gets the entity tag associated with the resource from the Azure DocumentDB database service. (Inherited from Resource.) | |
![]() | Gets or sets the Id of the resource in the Azure DocumentDB database service. (Inherited from Resource.) | |
![]() | Gets or sets the Resource Id associated with the resource in the Azure DocumentDB database service. (Inherited from Resource.) | |
![]() | Gets the self-link associated with the resource from the Azure DocumentDB database service. (Inherited from Resource.) | |
![]() | Gets the last modified timestamp associated with the resource from the Azure DocumentDB database service. (Inherited from Resource.) | |
![]() | Gets the self-link for users from the Azure DocumentDB database service. |
| Name | Description | |
|---|---|---|
![]() | Equals | (Inherited from Object.) |
![]() | Finalize | (Inherited from Object.) |
![]() | GetHashCode | (Inherited from Object.) |
![]() | GetPropertyValue | Gets property value associated with the specified property name from the Azure DocumentDB database service. (Inherited from Resource.) |
![]() | GetType | (Inherited from Object.) |
![]() | LoadFrom | Loads the object from the specified JSON reader in the Azure DocumentDB database service. (Inherited from JsonSerializable.) |
![]() | MemberwiseClone | (Inherited from Object.) |
![]() | SaveTo | Saves the object to the specified stream in the Azure DocumentDB database service. (Inherited from JsonSerializable.) |
![]() | SetPropertyValue | Sets property value associated with the specified property name in the Azure DocumentDB database service. (Inherited from Resource.) |
![]() | ToByteArray | Serialize to a byte array via SaveTo for the Azure DocumentDB database service. (Inherited from Resource.) |
![]() | ToString | Returns the string representation of the object in the Azure DocumentDB database service. (Inherited from JsonSerializable.) |
| Name | Description | |
|---|---|---|
![]() | IsDefined | Determines if a certain property is defined or not. (Defined by TypeCheckFunctionsExtensions.) |
![]() | IsNull | Determines if a certain property is null or not. (Defined by TypeCheckFunctionsExtensions.) |
![]() | IsPrimitive | Determines if a certain property is of premitive JSON type. (Defined by TypeCheckFunctionsExtensions.) |
Each Azure DocumentDB database account can have zero or more databases. A database in Azure DocumentDB is a logical container for document collections and users. Refer to for more details on databases.
The example below creates a new Database with an Id property of 'MyDatabase'.
using (DocumentClient client = new DocumentClient(new Uri("service endpoint"), "auth key")) { Database db = await client.CreateDatabaseAsync(new Database { Id = "MyDatabase" }); }
The example below creates a collection within this database with OfferThroughput set to 10000.
DocumentCollection coll = await client.CreateDocumentCollectionAsync(db.SelfLink, new DocumentCollection { Id = "MyCollection" }, new RequestOptions { OfferThroughput = 10000} );
The example below deletes the database using its SelfLink property.
await client.DeleteDatabaseAsync(db.SelfLink);
The example below queries for a Database by Id to retrieve the SelfLink.
using Microsoft.Azure.Documents.Linq; Database database = client.CreateDatabaseQuery().Where(d => d.Id == "MyDatabase").AsEnumerable().FirstOrDefault(); string databaseLink = database.SelfLink;
Any public static ( Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.


