> For the complete documentation index, see [llms.txt](https://atomic-blend.gitbook.io/mongo2pg/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://atomic-blend.gitbook.io/mongo2pg/operating-a-migration/operations.md).

# Operating a migration

A migration runs in one straight line of commands, then keeps streaming until you decide to cut over:

```bash
mongo2pg schema plan  --config mapping.yaml   # review the generated migrations first
mongo2pg schema apply --config mapping.yaml   # create the target tables
mongo2pg run          --config mapping.yaml   # backfill, then stream — the long-running command
```

While `run` is streaming, three commands answer the questions an operator actually has:

```bash
mongo2pg status                               # phases, lag, quarantine, readiness — one shot
mongo2pg verify                               # counts, checksums, re-mapped samples
mongo2pg cutover check                        # exit 0 means safe to switch
```

Every flag on every command is in the [CLI reference](/mongo2pg/reference/cli-reference.md). This section covers the *procedure* around them:

* [Cutover procedure](/mongo2pg/operating-a-migration/operations/cutover.md) — stop writers, gate, flip, rollback window, retire.
* [Verification and checks](/mongo2pg/operating-a-migration/operations/verification-and-checks.md) — exactly what `verify` and `cutover check` compute, and every condition the gate enforces.
* [Handling quarantine](/mongo2pg/operating-a-migration/operations/handling-quarantine.md) — what to do when a document is parked.
* [Operational realities](/mongo2pg/operating-a-migration/operations/operational-realities.md) — the things that only show up once you run this against a real database, not from reading the code.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://atomic-blend.gitbook.io/mongo2pg/operating-a-migration/operations.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
