Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Items

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

see

Item for reading, replacing, or deleting an existing container; use .item(id).

Hierarchy

  • Items

Index

Properties

container

container: Container

The parent container.

Methods

create

  • Create a item.

    Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

    There is no set schema for JSON items. They may contain any number of custom properties.

    Type parameters

    Parameters

    • body: T

      Represents the body of the item. Can contain any number of user defined properties.

    • Default value options: RequestOptions = {}

      Used for modifying the request (for instance, specifying the partition key).

    Returns Promise<ItemResponse<T>>

query

  • Queries all items.

    example

    Read all items to array.

    const querySpec: SqlQuerySpec = {
      query: "SELECT * FROM Families f WHERE f.lastName = @lastName",
      parameters: [
        {name: "@lastName", value: "Hendricks"}
      ]
    };
    const {result: items} = await items.query(querySpec).toArray();

    Parameters

    • query: string | SqlQuerySpec

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

    • Optional options: FeedOptions

      Used for modifying the request (for instance, specifying the partition key).

    Returns QueryIterator<any>

  • Queries all items.

    example

    Read all items to array.

    const querySpec: SqlQuerySpec = {
      query: "SELECT firstname FROM Families f WHERE f.lastName = @lastName",
      parameters: [
        {name: "@lastName", value: "Hendricks"}
      ]
    };
    const {result: items} = await items.query<{firstName: string}>(querySpec).toArray();

    Type parameters

    • T

    Parameters

    • query: string | SqlQuerySpec

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

    • options: FeedOptions

      Used for modifying the request (for instance, specifying the partition key).

    Returns QueryIterator<T>

readAll

  • Read all items.

    There is no set schema for JSON items. They may contain any number of custom properties.

    example

    Read all items to array.

    const {body: containerList} = await items.readAll().toArray();

    Parameters

    • Optional options: FeedOptions

      Used for modifying the request (for instance, specifying the partition key).

    Returns QueryIterator<ItemDefinition>

  • Read all items.

    Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

    There is no set schema for JSON items. They may contain any number of custom properties.

    example

    Read all items to array.

    const {body: containerList} = await items.readAll().toArray();

    Type parameters

    Parameters

    • Optional options: FeedOptions

      Used for modifying the request (for instance, specifying the partition key).

    Returns QueryIterator<T>

readChangeFeed

upsert

  • Upsert an item.

    There is no set schema for JSON items. They may contain any number of custom properties.

    Parameters

    • body: any

      Represents the body of the item. Can contain any number of user defined properties.

    • Optional options: RequestOptions

      Used for modifying the request (for instance, specifying the partition key).

    Returns Promise<ItemResponse<ItemDefinition>>

  • Upsert an item.

    Any provided type, T, is not necessarily enforced by the SDK. You may get more or less properties and it's up to your logic to enforce it.

    There is no set schema for JSON items. They may contain any number of custom properties.

    Type parameters

    Parameters

    • body: T

      Represents the body of the item. Can contain any number of user defined properties.

    • Optional options: RequestOptions

      Used for modifying the request (for instance, specifying the partition key).

    Returns Promise<ItemResponse<T>>

Generated using TypeDoc