Skip to content

mongoshield history

Show how one document changed across backups and the journal.

Terminal window
mongoshield history <namespace> <id> [options]

Looks a document up by _id in every backup (newest first) and, when a change journal exists, lists every change to it in between. Each version is shown with the fields that changed since the version before it. The _id is Extended JSON: '"ada"', 42, '{"$oid":"…"}'.

ArgumentDescription
<namespace>requiredThe collection, e.g. app.users
<id>requiredThe document's _id as Extended JSON
OptionDescription
--from <storage-url>Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config).
--backups <n|all>How many backups that hold the collection to search. Default: 10.
--skip-journalDo not read the change journal.
--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.

The history of one user:

Terminal window
mongoshield history app.users '{"$oid":"6523f1c2a1b2c3d4e5f60718"}'

Every backup, no journal, as JSON:

Terminal window
mongoshield history app.orders 42 --backups all --skip-journal --json