MongoDB Database Tools
$ mongodump Official High RiskMongoDB Database Tools bundles mongodump for binary BSON backups (--archive, --gzip), mongorestore (with --dryRun), mongoexport for JSON/CSV exports, and mongoimport. Paired with MONGODB_URI env vars or --config YAML files, it integrates cleanly into CI and agent ops.
brew install mongodb/brew/mongodb-database-tools mongodump and mongoexport stream multi-megabyte/gigabyte BSON archives and NDJSON files directly to disk; MCP is unsuitable for bulk backup/restore.
Agent-Readiness Checklist
Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.
FCRS-1.0 6-Dimension Breakdown
Fully non-interactive Go binaries (mongodump, mongoexport JSON output, mongorestore --dryRun), though mongodump itself logs progress to stderr rather than structured JSON.
- Non-interactive suite;
mongoexportwrites JSON andmongorestoresupports--dryRun
mongorestore --dryRun and --config YAML credential files improve safety, though mongorestore --drop and mongoimport --drop delete existing collections.
--dryRunonmongorestoreand--configfile support;--dropis destructive
Official Go binaries via Homebrew (mongodb/brew/mongodb-database-tools) and installers across macOS, Linux, and Windows.
- Cross-platform official Go binaries
Standardizes binary BSON backup/restore and JSON/CSV collection transfer across self-hosted MongoDB and Atlas.
- Complete toolkit covering BSON archives and JSON/CSV export/import
First-party MongoDB suite (mongodb/mongo-database-tools) under Apache-2.0.
- Official MongoDB repository under Apache-2.0
Detailed per-tool reference pages at mongodb.com/docs/database-tools/.
- Official docs at mongodb.com
Security, Auth & Guardrails
Supports --config=<yaml> files for URIs/passwords so credentials are omitted from process listings; commonly wrapped with $MONGODB_URI in scripts.
Apache-2.0 open-source CLI suite; MongoDB Atlas cluster usage/egress incurs vendor charges.
# MongoDB Database Tools Agent Rules - Pass connection URIs via `"$MONGODB_URI"` or `--config`, never literal passwords in logged args. - Run `mongorestore --dryRun` before restoring archives. - NEVER pass `--drop` to `mongorestore` or `mongoimport` without explicit user approval.
Agent-Ready Command Recipes
Safe Read-Only Queries
mongoexport mongoexport --uri="$MONGODB_URI" --collection=events --limit=50 --out=events.json
Exports up to 50 documents from events as newline-delimited JSON.
--dryRun mongorestore --uri="$MONGODB_URI" --archive=backup.archive.gz --gzip --dryRun
Simulates restoring a compressed BSON archive without writing any documents.
Controlled Writes & Previews
mongodump --uri="$MONGODB_URI" --archive=backup.archive.gz --gzip
Streams a consistent compressed BSON archive backup to backup.archive.gz.
Strengths for Agents
- +
mongorestore --dryRunverifies archive integrity and restore plans before mutating data. - +
--archive+--gzipenables clean single-file or piped BSON backups.
Caveats & Pitfalls
- !
mongodumpstatus/progress output is plain text rather than JSON. - ! Uses a multi-binary suite (
mongodump,mongorestore,mongoexport,mongoimport) rather than one unified subcommand binary.