Skip to content

Document required migration/backfill when enabling drafts on collections with existing documents #16730

Open

Description

@kunKun-tx

Documentation Issue

When enabling versions.drafts on a collection that already contains documents, existing documents may disappear from the admin list until corresponding version records are created or the field versioning is disabled.

This behavior has come up in previous issues, including:

Based on the discussion in #3910, this appears to be expected behavior unless a manual migration/backfill is performed. The admin list for draft-enabled collections can depend on records in the versions collection/table. If existing documents were created before drafts were enabled, they may not have corresponding version rows, so they do not appear in the admin UI.

Suggested Documentation Improvement

The docs for versions / drafts should explicitly warn users that enabling drafts on an existing collection with existing documents requires a migration or backfill step.

For example, the docs could include a warning like:

If you enable versions.drafts on a collection that already contains documents, existing documents may not appear in the admin list until version records are created for them. You may need to run a migration or resave/republish existing documents to create the required version entries.

In addition to the warning text, it would be helpful to include a migration/backfill example, or to support this through automatic data migration when versioning/drafts are enabled on a collection that already has existing content.

Example Scenario

  1. Create a collection without versions or drafts enabled.

  2. Add documents to the collection.

  3. Later update the collection config to enable drafts:

    versions: {
      drafts: true,
    }

Why This Matters

The current behavior can look like data loss because the documents still exist in the database, but the admin list appears empty. Clear documentation would help users understand that this is a migration/backfill issue rather than actual data deletion.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions