Database Database Database Class

Definition

Operations for reading or deleting an existing database.

CosmosClient for or creating new databases, and reading/querying all databases; use client.Databases.

public abstract class Database
type Database = class
Public MustInherit Class Database
Inheritance
DatabaseDatabaseDatabase

Remarks

Note: all these operations make calls against a fixed budget.

You should design your system such that these calls scale sub-linearly with your application.

For instance, do not call database.ReadAsync() before every single item.ReadAsync() call, to ensure the database exists;

do this once on application start up.

Constructors

Database() Database() Database()

Properties

Id Id Id

The Id of the Cosmos database

Methods

CreateContainerAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateContainerAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

CreateContainerIfNotExistsAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerIfNotExistsAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerIfNotExistsAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken)

Check if a container exists, and if it doesn't, create it. Only the container id is used to verify if there is an existing container. Other container properties such as throughput are not validated and can be different then the passed properties.

CreateContainerIfNotExistsAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerIfNotExistsAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerIfNotExistsAsync(String, String, Nullable<Int32>, RequestOptions, CancellationToken)

Check if a container exists, and if it doesn't, create it. This will make a read operation, and if the container is not found it will do a create operation.

CreateContainerStreamAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerStreamAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken) CreateContainerStreamAsync(ContainerProperties, Nullable<Int32>, RequestOptions, CancellationToken)

Creates a container as an asynchronous operation in the Azure Cosmos service.

DefineContainer(String, String) DefineContainer(String, String) DefineContainer(String, String)

Creates a containerBuilder.

DeleteAsync(RequestOptions, CancellationToken) DeleteAsync(RequestOptions, CancellationToken) DeleteAsync(RequestOptions, CancellationToken)

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

DeleteStreamAsync(RequestOptions, CancellationToken) DeleteStreamAsync(RequestOptions, CancellationToken) DeleteStreamAsync(RequestOptions, CancellationToken)

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

GetContainer(String) GetContainer(String) GetContainer(String)

Returns a reference to a container object.

GetContainerQueryIterator<T>(QueryDefinition, String, QueryRequestOptions) GetContainerQueryIterator<T>(QueryDefinition, String, QueryRequestOptions) GetContainerQueryIterator<T>(QueryDefinition, String, QueryRequestOptions)

This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetContainerQueryIterator<T>(String, String, QueryRequestOptions) GetContainerQueryIterator<T>(String, String, QueryRequestOptions) GetContainerQueryIterator<T>(String, String, QueryRequestOptions)

This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetContainerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions) GetContainerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions) GetContainerQueryStreamIterator(QueryDefinition, String, QueryRequestOptions)

This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

GetContainerQueryStreamIterator(String, String, QueryRequestOptions) GetContainerQueryStreamIterator(String, String, QueryRequestOptions) GetContainerQueryStreamIterator(String, String, QueryRequestOptions)

This method creates a query for containers under an database using a SQL statement. It returns a FeedIterator. For more information on preparing SQL statements with parameterized values, please see QueryDefinition overload.

ReadAsync(RequestOptions, CancellationToken) ReadAsync(RequestOptions, CancellationToken) ReadAsync(RequestOptions, CancellationToken)

Reads a DatabaseProperties from the Azure Cosmos service as an asynchronous operation.

ReadStreamAsync(RequestOptions, CancellationToken) ReadStreamAsync(RequestOptions, CancellationToken) ReadStreamAsync(RequestOptions, CancellationToken)

Reads a DatabaseProperties from the Azure Cosmos service as an asynchronous operation.

ReadThroughputAsync(CancellationToken) ReadThroughputAsync(CancellationToken) ReadThroughputAsync(CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

ReadThroughputAsync(RequestOptions, CancellationToken) ReadThroughputAsync(RequestOptions, CancellationToken) ReadThroughputAsync(RequestOptions, CancellationToken)

Gets database throughput in measurement of request units per second in the Azure Cosmos service.

ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken) ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken) ReplaceThroughputAsync(Int32, RequestOptions, CancellationToken)

Sets throughput provisioned for a database in measurement of request units per second in the Azure Cosmos service.

Applies to