Data Tasks
msq.dataTasks runs small, explicit rollout tasks for production index sync, filtered data sync, field transforms, affected-document snapshots, and verification.
It is not a schema migration framework and it does not keep an up/down migration ledger. Use MongoDB native import/export or an application-owned job for full database moves. Use data tasks when a release needs a reviewed, repeatable, bounded operation.
Task Lifecycle
The same flow is available from the CLI:
For dry-run, run, and verify, the task file should export { runtime, task } so the CLI can create a MonSQLize instance. plan can run without a database connection when the task only needs static validation.
Supported Steps
Safety Rules
filteris required forsyncData,transformFields, andexportAffectedunlessallowFullCollection: trueis set.- Cross-endpoint
syncDatarequires stable businessmatchByfields. Source_idmatching is blocked unlessallowSourceIdMatch: trueis set on the step. - Production tasks require
confirmProduction: truebefore write steps run. - Data write steps create an affected-document snapshot first. Set
snapshot: falseonly withallowRunWithoutSnapshot: true. - Index sync always reads
listIndexes()before creating anything. Conflicts are reported; dataTasks does not drop, rename, or rebuild conflicting indexes.
CLI Task File
Use .cjs when the task contains JavaScript functions, such as a transformFields.transform callback. Use .json for static plan-only checks or simple CLI tasks.