Introduction
MongoShield is a TypeScript library and command-line tool that backs up, restores and
copies MongoDB databases. It uses only the official Node.js driver: there is no
mongodump binary to install, so it runs wherever Node.js runs — a laptop, a Docker
container, a Kubernetes CronJob, GitHub Actions, AWS Lambda or Vercel.
What a backup is
Section titled “What a backup is”A backup is a directory of ordinary files in storage you control: local disk, S3 or an S3-compatible service, Google Cloud Storage, Azure Blob Storage or SFTP.
backups/2026-11-14T03-00-04Z_7f3a9c/ manifest.json written last: if it exists, the backup is complete app/users.metadata.json.age collection options and indexes (mongodump format) app/users.bson.zst.age documents as BSON, compressed, encryptedEvery layer is a standard format — mongodump's directory layout and BSON, zstd or gzip compression, and age encryption. If MongoShield disappeared, you could still restore with off-the-shelf tools:
age -d -i recovery.key users.bson.zst.age | zstd -d > users.bson && mongorestore …See How a backup is stored for the details.
What it does
Section titled “What it does”- Back up every collection type with its options and indexes, compressed and optionally encrypted, with a SHA-256 checksum for every file.
- Restore with safe defaults: nothing is overwritten unless you ask,
--renamerestores next to live data, and--dry-runshows the plan first. - Verify a backup without the key (sizes and checksums), or deeply by decrypting and parsing every document; run restore drills that prove a backup restores.
- Keep the right backups with a retention policy that never deletes your newest backup, held backups or (on supporting storage) backups that are still write-locked.
- Run unattended on a schedule, with locks, retries, notifications and heartbeats.
- Recover to a point in time with a change journal recorded between backups.
- Copy data between deployments, with deterministic masking and subsetting, for staging environments and laptops.
When to use something else
Section titled “When to use something else”MongoShield takes logical backups: it reads documents through the driver and writes them back on restore, rebuilding indexes. For very large deployments, restore time is dominated by re-inserting data and rebuilding indexes; storage-level snapshots (Atlas Cloud Backups, filesystem snapshots, Percona Backup for MongoDB's physical backups) restore faster. See Compare and Limitations for an honest picture.
Next steps
Section titled “Next steps”- Install the CLI or the library.
- Follow the CLI quickstart for a first backup and restore in five minutes.
- Or use it from code: Library quickstart.
MongoShield is MIT licensed and is not affiliated with, endorsed by or sponsored by MongoDB, Inc. MongoDB is a trademark of MongoDB, Inc.Privacy policy