> ## Documentation Index
> Fetch the complete documentation index at: https://docs.bijection.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Azure Cosmos DB documents and change feed

> Read Azure Cosmos DB for NoSQL documents or follow a physical partition range.

Use the [Documents installation](https://docs.bijection.com/integrations/native-elasticsearch) with
`azureCosmos` from `@bijectionhq/app-documents`. Pass the commercial Azure
account name in place of the HTTPS origin. Pass the same label to the receiver binder and as the app's `data`. Seal a URL-encoded Cosmos DB
resource token for a Read permission on the selected container. Rotate the
seal before the token expires.

Initialize a container traversal with the database and container names, the
container's Azure `_rid` and the top-level string partition key property.

```ts theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  selection: {
    mode: "cosmosdb",
    container: { database: "sales", container: "orders", resourceId: "d9RzAJRFKgw=", key: "tenant" },
  },
}
```

The app lands one document per answer, up to 36 KiB of JSON, under the
pair of partition key and item ID. The combined JSON key may occupy up to
384 UTF-8 bytes. The REST continuation is limited to 2 KiB. The app starts
another traversal after reaching the end. Pages may see concurrent changes.

For changes instead, set `mode: "cosmosdb-change-feed"` and include
`range: "0"` or the actual physical range ID in `container`. Install one
mount per range. The REST latest-version feed starts at the beginning,
then commits the complete answer with its ETag. It accepts up to 16 items
and 36 KiB per answer, including any provider transaction batch. An idle
poll keeps the last position. A missing or split range stops advancement.
Review the range IDs with Azure and install the replacement mounts after a
split. Read the revision and gap stamp through `source.health` before
resetting an unchanged range.

The latest-version feed can skip intermediate versions and omits physical
deletes. Deletion by absence is outside both modes.

## All versions and deletes

Enable **All versions and deletes change feed** on the Cosmos DB for NoSQL
account with continuous backups. Use the same physical range and container
settings as the latest-version feed, with the mode
`cosmosdb-all-versions-and-deletes`.

The first successful read takes the range's current feed position. The app
commits each complete answer with its ETag, including the ETag on idle polls.
It processes create and replace images and removes rows for explicit delete
events, including TTL expirations. Delete events use the provider's item ID
and string partition key. The mount publishes current rows and accepts up
to 16 events and 36 KiB per answer. Deletion by absence is outside this mode.

Keep the source within the account's continuous backup retention window.
A rejected retained position or replaced or split range stops advancement.
Review `source.health` before resetting an unchanged range. A reset starts
at the current feed head and preserves previously published rows. Install
replacement mounts for new physical ranges after a split.

[Cosmos DB REST document feeds](https://learn.microsoft.com/en-us/rest/api/cosmos-db/list-documents) ·
[Change feed modes](https://learn.microsoft.com/en-us/azure/cosmos-db/change-feed-modes) ·
[Read resource tokens](https://learn.microsoft.com/en-us/rest/api/cosmos-db/access-control-on-cosmosdb-resources)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.