mongoshield diff
Compare two backups, or a backup with the live database.
mongoshield diff <backupA> [backupB] [options]Compares every collection of two backups (or a backup and a live deployment): documents added, removed and changed (matched by _id), and differences in indexes and collection options. With one backup, it is compared with the latest.
Arguments
Section titled “Arguments”| Argument | Description | |
|---|---|---|
<backupA> | required | The older backup: an id or "latest" |
[backupB] | optional | The newer backup (default: latest) |
Options
Section titled “Options”| Option | Description |
|---|---|
--live <mongodb-uri> | Compare with this live deployment instead of a second backup. |
--details | Show example _ids and the differing indexes and options. |
--examples <n> | With --details: example _ids per category. Default: 10. |
--from <storage-url> | Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config). |
--include <pattern> | Only these namespaces, e.g. app.* or app.users. Repeatable. |
--exclude <pattern> | Skip these namespaces, e.g. *.audit_*. Repeatable. |
--identity-file <path> | age identity file for encrypted backups (from mongoshield keygen). Repeatable. |
--passphrase-env <VAR> | Read the encryption passphrase from this environment variable. |
The global options (--config, --json, --quiet,
--verbose, --no-color, --yes) work here too.
Examples
Section titled “Examples”What changed since a given backup:
mongoshield diff 2026-10-20T03-00-04Z_7f3a9cHow far the live database has drifted from the latest backup:
mongoshield diff latest --live "$MONGODB_URI" --detailsMongoShield is MIT licensed and is not affiliated with, endorsed by or sponsored by MongoDB, Inc. MongoDB is a trademark of MongoDB, Inc.Privacy policy