mongoshield rehearse-upgrade
Prove a backup works on a newer MongoDB version before upgrading.
mongoshield rehearse-upgrade [backup] [options]Checks the backup against MongoDB's compatibility notes for the target version (removed index types, removed JavaScript functions, the 8.0 null/undefined change, …), restores it into a server of that version, and runs the drill's checks plus validate, every view and every validator there. Without --target-uri an ephemeral mongod is started (needs the mongodb-memory-server package). The result is recorded next to the backup.
Arguments
Section titled “Arguments”| Argument | Description | |
|---|---|---|
[backup] | optional | Backup id, or "latest" (default) |
Options
Section titled “Options”| Option | Description |
|---|---|
--target-version <x.y[.z]> | The MongoDB version to rehearse (required), e.g. 8.0 or 8.0.13. |
--target-uri <mongodb-uri> | Scratch deployment running the target version (default: an ephemeral mongod). |
--mongod-binary <path> | mongod binary for the ephemeral server, instead of downloading one. |
--analyze-only | Only run the compatibility analysis (no server needed). |
--sample <n> | Documents per collection to compare byte for byte with the backup. Default: 100. |
--assertions <file> | A .ts/.js file whose default export checks the restored data. |
--keep | Keep the temporary databases (--target-uri only). |
--prefix <prefix> | Prefix of the temporary database names. Default: msdrill_. |
--include <pattern> | Only these namespaces, e.g. app.* or app.users. Repeatable. |
--exclude <pattern> | Skip these namespaces, e.g. *.audit_*. Repeatable. |
--from <storage-url> | Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config). |
--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”Rehearse the latest backup on an ephemeral MongoDB 8.0.13:
mongoshield rehearse-upgrade --target-version 8.0.13Rehearse on your own 8.0 staging cluster:
mongoshield rehearse-upgrade latest --target-version 8.0 --target-uri $STAGING_80_URIOnly check the compatibility notes, in CI, as JSON:
mongoshield rehearse-upgrade --target-version 8.0 --analyze-only --jsonMongoShield is MIT licensed and is not affiliated with, endorsed by or sponsored by MongoDB, Inc. MongoDB is a trademark of MongoDB, Inc.Privacy policy