Databases class

Operations for creating new databases, and reading/querying all databases

Properties

client

Methods

create(DatabaseRequest, RequestOptions)

Send a request for creating a database. A database manages users, permissions and a set of containers. Each Azure Cosmos DB Database Account is able to support multiple independent named databases, with the database being the logical container for data.

Each Database consists of one or more containers, each of which in turn contain one or more documents. Since databases are an administrative resource, the Service Master Key will be required in order to access and successfully complete any action using the User APIs.

createIfNotExists(DatabaseRequest, RequestOptions)

Check if a database exists, and if it doesn't, create it. This will make a read operation based on the id in the body, then if it is not found, a create operation. A database manages users, permissions and a set of containers. Each Azure Cosmos DB Database Account is able to support multiple independent named databases, with the database being the logical container for data.

Each Database consists of one or more containers, each of which in turn contain one or more documents. Since databases are an an administrative resource, the Service Master Key will be required in order to access and successfully complete any action using the User APIs.

query(string | SqlQuerySpec, FeedOptions)

Queries all databases.

query(string | SqlQuerySpec, FeedOptions)

Queries all databases.

readAll(FeedOptions)

Reads all databases.

Property Details

client

client: CosmosClient

Property Value

Method Details

create(DatabaseRequest, RequestOptions)

Send a request for creating a database. A database manages users, permissions and a set of containers. Each Azure Cosmos DB Database Account is able to support multiple independent named databases, with the database being the logical container for data.

Each Database consists of one or more containers, each of which in turn contain one or more documents. Since databases are an administrative resource, the Service Master Key will be required in order to access and successfully complete any action using the User APIs.

function create(body: DatabaseRequest, options?: RequestOptions)

Parameters

body
DatabaseRequest

The <xref:DatabaseDefinition> that represents the <xref:Database> to be created.

options
RequestOptions

Use to set options like response page size, continuation tokens, etc.

Returns

Promise<DatabaseResponse>

createIfNotExists(DatabaseRequest, RequestOptions)

Check if a database exists, and if it doesn't, create it. This will make a read operation based on the id in the body, then if it is not found, a create operation. A database manages users, permissions and a set of containers. Each Azure Cosmos DB Database Account is able to support multiple independent named databases, with the database being the logical container for data.

Each Database consists of one or more containers, each of which in turn contain one or more documents. Since databases are an an administrative resource, the Service Master Key will be required in order to access and successfully complete any action using the User APIs.

function createIfNotExists(body: DatabaseRequest, options?: RequestOptions)

Parameters

body
DatabaseRequest

The <xref:DatabaseDefinition> that represents the <xref:Database> to be created.

options
RequestOptions

Returns

Promise<DatabaseResponse>

query(string | SqlQuerySpec, FeedOptions)

Queries all databases.

function query(query: string | SqlQuerySpec, options?: FeedOptions)

Parameters

query
string | SqlQuerySpec

Query configuration for the operation. See <xref:SqlQuerySpec> for more info on how to configure a query.

options
FeedOptions

Use to set options like response page size, continuation tokens, etc.

Returns

query(string | SqlQuerySpec, FeedOptions)

Queries all databases.

function query<T>(query: string | SqlQuerySpec, options?: FeedOptions)

Parameters

query
string | SqlQuerySpec

Query configuration for the operation. See <xref:SqlQuerySpec> for more info on how to configure a query.

options
FeedOptions

Use to set options like response page size, continuation tokens, etc.

Returns

readAll(FeedOptions)

Reads all databases.

function readAll(options?: FeedOptions)

Parameters

options
FeedOptions

Use to set options like response page size, continuation tokens, etc.

Returns

QueryIterator<Resource>