Essential session storage is required to sign in. Optional analytics remain off unless you allow them.
Harden and optimize a collection. Add $jsonSchema validation (required fields, bsonType, enum) via collection options. For the app's real queries, create COMPOUND indexes following the ESR rule (Equality, Sort, Range) and prove with explain('executionStats') that hot queries use an IXSCAN (not a COLLSCAN) and examine few docs. Then build non-trivial aggregation pipelines: a $lookup join to a second collection, a $group analytics report, and a $unwind over an array. Document why each index exists.
Compound indexes follow ESR for the actual queries; explain() shows IXSCAN with low docsExamined; each index justified.
$jsonSchema validator enforces required fields/types; validationAction chosen deliberately.
A working $lookup join, a $group report, and a $unwind — correct and efficient (e.g. $match early).
Can explain index choices and pipeline ordering for performance.
Use this README structure to make the work reviewable.
DevPath fetches a read-only, size-capped snapshot. Submitted code is never executed.
# An indexed, validated collection with aggregation reports
## Goal
Harden and optimize a collection. Add $jsonSchema validation (required fields, bsonType, enum) via collection options. For the app's real queries, create COMPOUND indexes following the ESR rule (Equality, Sort, Range) and prove with explain('executionStats') that hot queries use an IXSCAN (not a COLLSCAN) and examine few docs. Then build non-trivial aggregation pipelines: a $lookup join to a second collection, a $group analytics report, and a $unwind over an array. Document why each index exists.
## Acceptance criteria
- [ ] Indexes & explain(): Compound indexes follow ESR for the actual queries; explain() shows IXSCAN with low docsExamined; each index justified.
- [ ] Schema validation: $jsonSchema validator enforces required fields/types; validationAction chosen deliberately.
- [ ] Aggregation: A working $lookup join, a $group report, and a $unwind — correct and efficient (e.g. $match early).
- [ ] Reasoning: Can explain index choices and pipeline ordering for performance.
## Verification
- [ ] Document installation and run commands.
- [ ] Record automated checks and their exact commands.
- [ ] Add representative output, screenshots, or a short demo where useful.
- [ ] Confirm failure paths and known constraints.
## Decision log
### Decision title
- Context:
- Choice:
- Alternatives considered:
- Tradeoffs:
## Evidence
- Link each rubric criterion to the file, test, or artifact that demonstrates it.
## Known limitations
- List what is intentionally out of scope and what should be improved next.