mongoshield pull
Copy production data into a local MongoDB, masked.
mongoshield pull [options]Like copy, with safe defaults for local development: the target defaults to mongodb://localhost:27017 and must be on this machine, and a --mask file is required (--no-mask --yes copies raw data, deliberately). Add --subset for a smaller slice.
Options
Section titled “Options”| Option | Description |
|---|---|
--from <mongodb-uri> | Copy from this deployment (default: the configured source / MONGODB_URI). |
--include <pattern> | Only these namespaces, e.g. app.* or app.users. Repeatable. |
--exclude <pattern> | Skip these namespaces, e.g. *.audit_*. Repeatable. |
--rename <from=to> | Copy under another name, e.g. 'app.*=app_staging.*'. Repeatable. |
--mask <file> | Mask file (e.g. ./mask.ts) applied to every document on its way. |
--mask-secret-env <VAR> | Read the masking secret from this variable when the mask file sets none. Default: MONGOSHIELD_MASK_SECRET. |
--subset <file> | Subset file (e.g. ./subset.ts): filters, and references to follow. |
--mode <fail-if-exists|drop|insert|upsert> | What to do when a target collection already exists. Default: fail-if-exists. |
--drop | Same as --mode drop. |
--dry-run | Show the plan and stop; write nothing. |
--parallelism <n> | Collections copied at the same time (1–64). Default: 4. |
--skip-indexes | Do not create indexes (faster, for throwaway targets). |
--skip-search-indexes | Do not recreate Atlas Search / Vector Search indexes on the target. |
--resume | Continue an interrupted copy from its checkpoint (same options as before). |
--checkpoint <file> | Where the copy records its progress for --resume. Default: .mongoshield/copy-<id>.json. |
--to <mongodb-uri> | Copy into this local deployment. Default: mongodb://localhost:27017. |
--no-mask | Copy without masking (needs --yes; the data stays as sensitive as production). |
--allow-remote-target | Allow a --to that is not on this machine. |
The global options (--config, --json, --quiet,
--verbose, --no-color, --yes) work here too.
Examples
Section titled “Examples”Pull a masked copy of the app database to the local MongoDB:
mongoshield pull --from $PROD_URI --include 'app.*' --mask ./mask.tsRefresh a masked, recent slice, replacing yesterday's:
mongoshield pull --mask ./mask.ts --subset ./subset.ts --drop --yesMongoShield is MIT licensed and is not affiliated with, endorsed by or sponsored by MongoDB, Inc. MongoDB is a trademark of MongoDB, Inc.Privacy policy