Package version:
Execute transactional batch operations on items.
Batch takes an array of Operations which are typed based on what the operation does. Batch is transactional and will rollback all operations if one fails. The choices are: Create, Upsert, Read, Replace, and Delete
Usage example:
// The partitionKey is a required second argument. If it’s undefined, it defaults to the expected partition key format.
const operations: OperationInput[] = [
{
operationType: "Create",
resourceBody: { id: "doc1", name: "sample", key: "A" }
},
{
operationType: "Upsert",
resourceBody: { id: "doc2", name: "other", key: "A" }
}
]
await database.container.items.batch(operations, "A")
List of operations. Limit 100
Optional
partitionKey: PartitionKeyOptional
options: RequestOptionsUsed for modifying the request
Execute bulk operations on items.
Bulk takes an array of Operations which are typed based on what the operation does. The choices are: Create, Upsert, Read, Replace, and Delete
Usage example:
// partitionKey is optional at the top level if present in the resourceBody
const operations: OperationInput[] = [
{
operationType: "Create",
resourceBody: { id: "doc1", name: "sample", key: "A" }
},
{
operationType: "Upsert",
partitionKey: 'A',
resourceBody: { id: "doc2", name: "other", key: "A" }
}
]
await database.container.items.bulk(operations)
List of operations. Limit 100
Optional
bulkOptions: BulkOptionsOptional options object to modify bulk behavior. Pass { continueOnError: false } to stop executing operations when one fails. (Defaults to true)
Optional
options: RequestOptionsUsed for modifying the request.
Create a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate 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.
Represents the body of the item. Can contain any number of user defined properties.
Used for modifying the request (for instance, specifying the partition key).
Returns an iterator to iterate over pages of changes. The iterator returned can be used to fetch changes for a single partition key, feed range or an entire container.
Optional
changeFeedIteratorOptions: ChangeFeedIteratorOptionsQueries all items.
Query configuration for the operation. See SqlQuerySpec for more info on how to configure a query.
Optional
options: FeedOptionsUsed for modifying the request (for instance, specifying the partition key).
Queries all items.
Query configuration for the operation. See SqlQuerySpec for more info on how to configure a query.
Optional
options: FeedOptionsUsed for modifying the request (for instance, specifying the partition key).
Read all items.
There is no set schema for JSON items. They may contain any number of custom properties.
Optional
options: FeedOptionsUsed for modifying the request (for instance, specifying the partition key).
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.
Optional
options: FeedOptionsUsed for modifying the request (for instance, specifying the partition key).
Create a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator
to iterate over pages of changes
Optional
changeFeedOptions: ChangeFeedOptionsUpsert an item.
There is no set schema for JSON items. They may contain any number of custom properties.
Represents the body of the item. Can contain any number of user defined properties.
Optional
options: RequestOptionsUsed for modifying the request (for instance, specifying the partition key).
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.
Represents the body of the item. Can contain any number of user defined properties.
Optional
options: RequestOptionsUsed for modifying the request (for instance, specifying the partition key).
Operations for creating new items, and reading/querying all items
See
Item for reading, replacing, or deleting an existing container; use
.item(id)
.