mongoshield erase
Record a GDPR erasure so restores never bring the data back.
mongoshield erase <namespace> <filter> [options]Appends an erasure to the ledger next to the backups. Every later restore, rollback and copy deletes the matching documents again. --now also deletes them from the live database. Exact matches on strings are stored as keyed hashes (set MONGOSHIELD_ERASURE_SECRET), so the ledger does not keep the personal data.
Arguments
Section titled “Arguments”| Argument | Description | |
|---|---|---|
<namespace> | required | db.collection, a pattern like app.*, or * |
<filter> | required | Extended JSON filter, e.g. '{"email": "ada@example.com"}' |
Options
Section titled “Options”| Option | Description |
|---|---|
--reason <text> | Why (required). Reference the request, not the personal data. |
--by <name> | Who requested or approved it (default: user@host). |
--now | Also delete the documents from the live database. |
--uri <mongodb-uri> | The live database for --now (default: config source.uri). |
--to <storage-url> | Where backups are stored: ./dir, file:///abs, s3://bucket/prefix (default: config). |
The global options (--config, --json, --quiet,
--verbose, --no-color, --yes) work here too.
Examples
Section titled “Examples”Erase a user everywhere, now and in every future restore:
mongoshield erase app.users '{"email": "ada@example.com"}' --reason "GDPR request #4471" --nowErase a customer's documents in every collection that has a userId:
mongoshield erase 'app.*' '{"userId": 1042}' --reason "account deletion 1042"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