Skip to content

Import plugin are deleting ID when create so it dose not work with custom ID #15231

@anhdd-kuro

Description

@anhdd-kuro

Describe the Bug

We want to import IDs too, but for now the import plugin deletes all IDs before creating data.
Here in create mode
Or here in up-sert

So it's impossible to import while keeping the old IDs to respect their relationships between collections, or if we simply have customized IDs that are not auto-generated ( for example: collection that manually inserted by daily batches from another system)., then the import fails because the ID is missing

Why have to delete id in the first place ?

Link to the code that reproduces this issue

https://github.com/payloadcms/payload/blob/main/packages/plugin-import-export/src/import/batchProcessor.ts#L445

Reproduction Steps

  • Create any collection with custom ID
 {
    name: 'id',
    type: 'text',
    required: true,
    unique: true,
    index: true,
    admin: {
      hidden: true,
    },
},
  • Import any data base from that collection
[
  {
    "id": "1",
    "name": "Test",
  }
]

Which area(s) are affected?

plugin: import-export

Environment Info

Binaries:
  Node: 25.2.1
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.24.0
Relevant Packages:
  payload: 3.71.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0: Mon Jul 14 11:30:40 PDT 2025; root:xnu-

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