> ## 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.

# Amazon DocumentDB collection observations

> Observe one DocumentDB collection over authenticated MongoDB wire protocol.

Run a self-hosted Bijection backend with `--self-hosted-egress` and a
private route to the DocumentDB VPC. Deploy in the same VPC or use an
existing private connection, such as VPC peering or VPN. Resolve the AWS
instance endpoint to its private address from the backend and allow port
27017 from the backend in the DocumentDB security group. Use the AWS
instance's DNS name for TLS. If an
[installation egress policy](https://docs.bijection.com/operate/networking#installation-egress-policy)
is active, include that hostname and port.

Follow the [Documents mount](https://docs.bijection.com/integrations/native-mongodb.md#mount-and-start)
with `documentDbCollection(endpoint, credential, data)`. Pass the same label to the receiver binder and as the app's `data`.
Seal the following JSON. The CA is the PEM contents of the AWS regional
RDS trust bundle for the instance.

```json theme={"theme":{"light":"github-light-default","dark":"github-dark-default"}}
{
  "database": "inventory",
  "collection": "orders",
  "authDatabase": "admin",
  "username": "orders_reader",
  "password": "<password>",
  "ca": "<AWS regional RDS CA PEM>",
  "incarnation": "orders-1"
}
```

Initialize with `{ selection: { mode: "document-db" } }`. Use a principal
authorized for `listCollections` on the database and `find` on the collection.
The driver verifies the AWS hostname against the supplied CA and performs
SCRAM-SHA-1 within TLS. It uses one fixed MongoDB wire socket, with none
of the DocumentDB cluster discovery or IAM authentication exchanges.

Use a collection whose keys are all BSON ObjectIds. The query uses
an exclusive `_id` range with the provider's typing and sort, with one
record per page. The installation retains a typed document image and a key position
scoped to the installed incarnation. The driver checks the collection
before and after the read and uses a collection UUID when the server
supplies one. Set a fresh `incarnation` when restoring or replacing the
collection and review the source reset. A sweep ends when a page is
empty. Missing documents remain published. Each document can use up
to 36 KiB of JSON within a 48 KiB encoded answer. The profile observes
documents without opening a change stream.

[Connecting to DocumentDB](https://docs.aws.amazon.com/documentdb/latest/devguide/connect-docdb.html) ·
[DocumentDB SCRAM authentication](https://docs.aws.amazon.com/documentdb/latest/devguide/scram-sha-256-auth.html)


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