Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Database

Operations for reading or deleting an existing database.

see

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

Note: all these operations make calls against a fixed budget. You should design your system such that these calls scale sublinearly with your application. For instance, do not call database.read() before every single item.read() call, to ensure the database exists; do this once on application start up.

Hierarchy

  • Database

Index

Constructors

Properties

Accessors

Methods

Constructors

constructor

Properties

client

client: CosmosClient

containers

containers: Containers

Used for creating new containers, or querying/reading all containers.

Use .container(id) to read, replace, or delete a specific, existing Database by id.

example

Create a new container

const {body: containerDefinition, container} = await client.database("<db id>").containers.create({id: "<container id>"});

id

id: string

users

users: Users

Used for creating new users, or querying/reading all users.

Use .user(id) to read, replace, or delete a specific, existing User by id.

Accessors

url

  • get url(): string

Methods

container

  • Used to read, replace, or delete a specific, existing Database by id.

    Use .containers creating new containers, or querying/reading all containers.

    example

    Delete a container

    await client.database("<db id>").container("<container id>").delete();

    Parameters

    • id: string

    Returns Container

delete

read

user

  • user(id: string): User
  • Used to read, replace, or delete a specific, existing User by id.

    Use .users for creating new users, or querying/reading all users.

    Parameters

    • id: string

    Returns User

Generated using TypeDoc