Indexes
Indexes are persistent B-trees over a document path. They survive restarts —
no rebuild on startup — and turn WHERE path = … from a scan into a direct
lookup.
db.CreateIndex("orders", "pnr", "idx_pnr", unique: true);
db.CreateIndex("orders", "passenger.lastName", "idx_lastname");- Unique indexes enforce at most one document per key.
- Nested-path indexes cover object fields and array elements.
- The query planner uses an index automatically when a predicate matches its path.
If an index catalog is ever damaged, the engine self-heals it on open rather than refusing to start. See the indexing guide for choosing what to index.
Last updated on