Skip to content
Merged
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
6 changes: 6 additions & 0 deletions backend/app/services/runs_db_mongo.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,12 @@ def _ensure_indexes(coll) -> None:
# /api/runs/list hot shapes: filter+sort compounds so Mongo never
# in-memory-sorts a 40k-doc subset, plus seed for anchored prefix search.
coll.create_index([("seed", ASCENDING)])
# Admin hide/delete/search look runs up by hash. _id IS the hash for
# single-player runs; multiplayer runs carry a shared run_hash field. Index
# it (sparse — only MP docs have the field) so the admin lookup
# $or: [{_id}, {run_hash}] is an index union instead of a full scan of the
# ~740k-doc collection.
coll.create_index([("run_hash", ASCENDING)], sparse=True)
coll.create_index([("run_time", ASCENDING)])
coll.create_index([("ascension", DESCENDING), ("run_time", ASCENDING)])
coll.create_index([("character", ASCENDING), ("submitted_at", DESCENDING)])
Expand Down
Loading