mongospectre — MongoDB collection and index auditor. Part of SpectreHub.
- Connects to MongoDB and fetches collection metadata, index definitions, and usage statistics
- Scans code repositories for collection and field references across Go, Python, JS/TS, Java, C#, Ruby
- Extracts queried fields from aggregation pipelines
- Compares code references against live database to find drift, unused indexes, and missing collections
- Outputs text, JSON, SARIF, and SpectreHub formats
- Not a MongoDB monitoring tool — use mongostat/mongotop for that
- Not a migration tool or query profiler
- Not a backup or replication tool
- Does not modify any data — strictly read-only
brew tap ppiankov/tap
brew install mongospectregit clone https://github.com/ppiankov/mongospectre.git
cd mongospectre
make buildmongospectre audit --uri "mongodb://localhost:27017" --db mydb| Command | Description |
|---|---|
mongospectre audit |
Audit MongoDB for unused indexes and collection drift |
mongospectre check |
Compare code references against live database |
mongospectre watch |
Continuous drift detection |
mongospectre version |
Print version |
mongospectre feeds MongoDB drift findings into SpectreHub for unified visibility across your infrastructure.
spectrehub collect --tool mongospectremongospectre operates in read-only mode. It inspects and reports — never modifies, deletes, or alters your data.
| Document | Contents |
|---|---|
| CLI Reference | Full command reference, flags, and configuration |
MIT — see LICENSE.
Built by Obsta Labs