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
OptionalpartitionKey: PartitionKeyOptionaloptions: 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
OptionalbulkOptions: BulkOptionsOptional options object to modify bulk behavior. Pass { continueOnError: false } to stop executing operations when one fails. (Defaults to true)
Optionaloptions: RequestOptionsUsed for modifying the request.
Create a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: 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.
OptionalchangeFeedIteratorOptions: ChangeFeedIteratorOptionsQueries all items in an encrypted container.
Query configuration for the operation. See SqlQuerySpec for more info on how to build a query on encrypted properties.
Used for modifying the request (for instance, specifying the partition key).
const queryBuilder = new EncryptionQueryBuilder("SELECT firstname FROM Families f WHERE f.lastName = @lastName");
queryBuilder.addStringParameter("@lastName", "Hendricks", "/lastname");
const queryIterator = await items.getEncryptionQueryIterator<{firstName: string}>(queryBuilder);
const {result: items} = await queryIterator.fetchAll();
Queries all items.
Query configuration for the operation. See SqlQuerySpec for more info on how to configure a query.
Optionaloptions: 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.
Optionaloptions: 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.
Optionaloptions: 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.
Optionaloptions: FeedOptionsUsed for modifying the request (for instance, specifying the partition key).
Create a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: ChangeFeedOptionsCreate a ChangeFeedIterator to iterate over pages of changes
OptionalchangeFeedOptions: 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.
Optionaloptions: 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.
Optionaloptions: 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).