Scheduler Storage Mongo — Sprint 16 Handoff
This module now consumes the canonical DTOs defined in StellaOps.Scheduler.Models.
Samples covering REST shapes live under samples/api/scheduler/ and are referenced from docs/11_DATA_SCHEMAS.md#3.1.
Collections & DTO mapping
| Collection | DTO | Notes | 
|---|---|---|
| schedules | Schedule | Persist Scheduleas-is._id→Schedule.Id. Use compound indexes on{tenantId, enabled}and{whenCron}per doc. | 
| runs | Run | Store Run.Statsinside the document; omitdeltasarray when empty. | 
| impact_snapshots | ImpactSet | Normalise selector filter fields exactly as emitted by the canonical serializer. | 
| audit | AuditRecord | Lower-case metadata keys are already enforced by the model. | 
All timestamps are persisted as UTC (+00:00). Empty selector filters remain empty arrays (see impact-set.json sample).
Implementation guidance
- Add a project reference to StellaOps.Scheduler.Modelsand reuse the records directly; avoid duplicate BSON POCOs.
- When serialising/deserialising to MongoDB, call CanonicalJsonSerializerto keep ordering stable for diffable fixtures.
- Integration tests should load the JSON samples and round-trip through the Mongo persistence layer to guarantee parity.
- Follow docs/11_DATA_SCHEMAS.mdfor index requirements; update that doc if storage diverges.
- Register AddSchedulerMongoStoragein the host and callISchedulerMongoInitializer.EnsureMigrationsAsyncduring bootstrap so collections/indexes are created before workers/web APIs start.
With these artefacts in place the dependency on SCHED-MODELS-16-101/102 is cleared—storage work can move to DOING.