StoredProcedures class

Operations for creating, upserting, or reading/querying all Stored Procedures.

For operations to read, replace, delete, or execute a specific, existing stored procedure by id, see container.storedProcedure().

Properties

container

Methods

create(StoredProcedureDefinition, RequestOptions)

Create a StoredProcedure.

Azure Cosmos DB allows stored procedures to be executed in the storage tier, directly against an item container. The script gets executed under ACID transactions on the primary storage partition of the specified container. For additional details, refer to the server-side JavaScript API documentation.

query(SqlQuerySpec, FeedOptions)

Query all Stored Procedures.

Example

Read all stored procedures to array.

const querySpec: SqlQuerySpec = {
  query: "SELECT * FROM root r WHERE r.id = @sproc",
  parameters: [
    {name: "@sproc", value: "Todo"}
  ]
};
const {body: sprocList} = await containers.storedProcedures.query(querySpec).fetchAll();
query<T>(SqlQuerySpec, FeedOptions)

Query all Stored Procedures.

Example

Read all stored procedures to array.

const querySpec: SqlQuerySpec = {
  query: "SELECT * FROM root r WHERE r.id = @sproc",
  parameters: [
    {name: "@sproc", value: "Todo"}
  ]
};
const {body: sprocList} = await containers.storedProcedures.query(querySpec).fetchAll();
readAll(FeedOptions)

Read all stored procedures.

Example

Read all stored procedures to array.

const {body: sprocList} = await containers.storedProcedures.readAll().fetchAll();

Property Details

container

container: Container

Property Value

Method Details

create(StoredProcedureDefinition, RequestOptions)

Create a StoredProcedure.

Azure Cosmos DB allows stored procedures to be executed in the storage tier, directly against an item container. The script gets executed under ACID transactions on the primary storage partition of the specified container. For additional details, refer to the server-side JavaScript API documentation.

function create(body: StoredProcedureDefinition, options?: RequestOptions): Promise<StoredProcedureResponse>

Parameters

options
RequestOptions

Returns

query(SqlQuerySpec, FeedOptions)

Query all Stored Procedures.

Example

Read all stored procedures to array.

const querySpec: SqlQuerySpec = {
  query: "SELECT * FROM root r WHERE r.id = @sproc",
  parameters: [
    {name: "@sproc", value: "Todo"}
  ]
};
const {body: sprocList} = await containers.storedProcedures.query(querySpec).fetchAll();
function query(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<any>

Parameters

query
SqlQuerySpec

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

options
FeedOptions

Returns

query<T>(SqlQuerySpec, FeedOptions)

Query all Stored Procedures.

Example

Read all stored procedures to array.

const querySpec: SqlQuerySpec = {
  query: "SELECT * FROM root r WHERE r.id = @sproc",
  parameters: [
    {name: "@sproc", value: "Todo"}
  ]
};
const {body: sprocList} = await containers.storedProcedures.query(querySpec).fetchAll();
function query<T>(query: SqlQuerySpec, options?: FeedOptions): QueryIterator<T>

Parameters

query
SqlQuerySpec

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

options
FeedOptions

Returns

readAll(FeedOptions)

Read all stored procedures.

Example

Read all stored procedures to array.

const {body: sprocList} = await containers.storedProcedures.readAll().fetchAll();
function readAll(options?: FeedOptions): QueryIterator<StoredProcedureDefinition & Resource>

Parameters

options
FeedOptions

Returns