Skip to content

ppiankov/mongospectre

Repository files navigation

mongospectre

CI Go Report Card ANCC

mongospectre — MongoDB collection and index auditor. Part of SpectreHub.

What it is

  • 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

What it is NOT

  • 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

Quick start

Homebrew

brew tap ppiankov/tap
brew install mongospectre

From source

git clone https://github.com/ppiankov/mongospectre.git
cd mongospectre
make build

Usage

mongospectre audit --uri "mongodb://localhost:27017" --db mydb

CLI commands

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

SpectreHub integration

mongospectre feeds MongoDB drift findings into SpectreHub for unified visibility across your infrastructure.

spectrehub collect --tool mongospectre

Safety

mongospectre operates in read-only mode. It inspects and reports — never modifies, deletes, or alters your data.

Documentation

Document Contents
CLI Reference Full command reference, flags, and configuration

License

MIT — see LICENSE.


Built by Obsta Labs

About

Static + runtime MongoDB auditor. Scans codebases for Mongo collection & query usage, compares to live database schema and indexes, detects missing collections, unused collections, schema drift, and unindexed queries.

Topics

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages