Package version:

Class Container

Operations for reading, replacing, or deleting a specific, existing container by id.

Containers for creating new containers, and reading/querying all containers; use .containers.

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 container(id).read() before every single item.read() call, to ensure the container exists; do this once on application start up.

Properties

database: Database

The parent Database.

id: string

The id of the given container.

Accessors

  • get items(): Items
  • Operations for creating new items, and reading/querying all items

    For reading, replacing, or deleting an existing item, use .item(id).

    Returns Items

    const {body: createdItem} = await container.items.create({id: "<item id>", properties: {}});
    

Methods

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

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

    Parameters

    • id: string

      The id of the Item.

    • OptionalpartitionKeyValue: PartitionKey

      The value of the Item partition key

    Returns Item

    Replace an item
    `const {body: replacedItem} = await container.item("<item id>", "<partition key value>").replace({id: "<item id>", title: "Updated post", authorID: 5});`