Schema drift
Your application keeps shipping new fields while a live sync runs. Drift handling decides what happens to a field the schema mapping doesn't know about yet.
What counts as drift
During a MongoDB live sync, every change event is compared against the migration's schema mapping. A field present in the document but absent from the mapping is drift. Each one is recorded once, with the field, the inferred type and the action taken.
Drift detection runs on MongoDB live syncs. For other sources, re-run schema inference before starting a new migration to pick up new fields.
Drift policies
| Policy | What happens |
|---|---|
add_column | Default. NoSQLSync adds a column with the inferred type (ALTER TABLE … ADD COLUMN), updates the mapping and keeps streaming. The new field is populated from that point on. |
ignore | The field is recorded but not copied. The sync keeps running. |
alert_and_pause | The migration is set to paused so a person can review the change, update the mapping and resume. |
Every drift event — whatever the policy — fires a schema.drift webhook.
Target support
Adding columns automatically works on PostgreSQL, MySQL and MariaDB targets. On SQL Server and warehouse targets (BigQuery, Snowflake, Redshift, ClickHouse) the field is recorded with action unsupported_target and skipped — add the column yourself and update the mapping, or use alert_and_pause to be told immediately. MongoDB targets need no schema changes and copy new fields automatically.
Changing the policy
Set the policy when creating a migration, or change it at any time:
PATCH /migrations/:id
{ "driftPolicy": "alert_and_pause" }Reviewing drift
The migration page lists recent drift events. Over the API:
GET /migrations/:id/driftEach event includes sourceField, targetColumn, type and action — one of added_column, ignored, paused or unsupported_target.
Recommendations
- Use
add_columnfor analytics replicas where new fields should just appear. - Use
alert_and_pausefor migrations feeding a production application, where an unexpected column should be reviewed. - Use
ignorefor collections with free-form metadata you never want as columns.