Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 14 additions & 2 deletions blogs/_posts/2026-11-13-collated-collections-and-indexes.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ Should a query for `"a"` also match `"A"`? By using collation, you can make that

DocumentDB OSS beginning **v1.3 supports creating unsharded collections with collation**. Collation uses Unicode (ICU) rules for locale-aware string comparisons, including case- and accent-insensitive matching. Supported collated indexes can serve queries whose collation matches the index.

> **v1.3 isn't released yet.** The newest published image is v1.2, which lacks the `documentdb.enable_collation_with_create_collection` flag, so step 2 fails on it. Until v1.3 ships, you need an image built from the [`main` branch](https://github.com/documentdb/documentdb); the [changelog](https://github.com/documentdb/documentdb/blob/main/CHANGELOG.md) shows when it's released.

This walkthrough enables the required feature flags, creates a collection and a non-unique index, and demonstrates a case-insensitive query. It is based on [the original example and feature-flag notes](https://gist.github.com/xgerman/0d84036a676927a9382785cbffc857af).

## Choose how strings compare
Expand All @@ -30,14 +32,24 @@ Use `{ locale: "en", strength: 2 }`, so `"a"` and `"A"` compare equal, as do `"b

## 1. Start a local container

You need Docker and a **DocumentDB OSS v1.3 image**. The following command uses `latest`, a moving tag; ensure the image includes v1.3 before proceeding.
You need Docker and a **DocumentDB OSS v1.3 image**. The following command uses `latest`, a moving tag that points to v1.2 until v1.3 is released.

```bash
docker run -d --name docdb-test -p 127.0.0.1:10260:10260 \n -e USERNAME=testuser \n -e PASSWORD=testpass123 \n ghcr.io/documentdb/documentdb/documentdb-local:latest
docker run -d --name docdb-test -p 127.0.0.1:10260:10260 \
-e USERNAME=testuser \
-e PASSWORD=testpass123 \
ghcr.io/documentdb/documentdb/documentdb-local:latest
```

Allow the gateway to finish starting before connecting. The published port is bound to localhost, and the credentials are for this disposable local example only.

Check the version before you continue; it must be `1.3-0` or later:

```bash
docker exec docdb-test psql -X -U documentdb -p 9712 -d postgres \
-Atc "SELECT extversion FROM pg_extension WHERE extname = 'documentdb';"
```

## 2. Enable the collation feature flags

To create a collated collection, you need to enable **all five feature flags** listed below, even if the application index you create is non-unique.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ For conventional actor-based auditing of writes and collection DDL:
4. Leave global auditing disabled and enable `write, ddl` on each audited role.
5. Keep SQL statement and parameter logging disabled; enable relation and row-count logging.
6. Reconnect clients and verify the resulting records with a representative workload.
7. Send logs to a durable, access-controlled Microsoft Purview Audit sink.
7. Send logs to a durable, access-controlled audit-log destination.
8. Retain catalog mapping history if consumers require logical collection names.

For authoritative commit outcomes, document reconstruction, or recovery after ordinary Audit logs are lost, complement this approach with [WAL-based forensic analysis](https://github.com/xgerman/documentdb-wal-audit) and an appropriate WAL-retention strategy.
For authoritative commit outcomes, document reconstruction, or recovery after ordinary audit logs are lost, complement this approach with [WAL-based forensic analysis](https://github.com/xgerman/documentdb-wal-audit) and an appropriate WAL-retention strategy.

The useful distinction is simple: **pgAudit records actor-attributed PostgreSQL activity; WAL-based analysis addresses what committed and what can be reconstructed.** Choose the evidence your audit requirements actually need.
7 changes: 7 additions & 0 deletions tests/containerCredentials.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,4 +49,11 @@ describe('container credentials', () => {
}
}
});

// A literal \n in Markdown is two characters, not a line break; the pasted command fails.
it.each(sources().filter((file) => file.endsWith('.md')).map((file) => [path.relative(root, file), file]))('%s has no literal \\n in a run command', (_name, file) => {
for (const command of runCommands(fs.readFileSync(file, 'utf8'))) {
expect(command).not.toMatch(/\\n/);
}
});
});
Loading