#Error: Encountered two children with the same key

16 messages · Page 1 of 1 (latest)

hard shell
#

I think I accidentally added two fields to Payload with the same name, and while I deleted them, they are already in Mongo DB.

I only get that error on the pages where I accidentally added the duplicate one, pages where I didn't work fine

Would someone know of a fix?

Currently thinking of deleting _pages_versions from Mongo so that it is no longer part of the versioning history, but would that break my Payload or would Payload be smart enough to just create it back? (altough empty)

Using payload 3.35.1

hard shell
#

@west dagger this is the issue

west dagger
#

if it's only for 1 / a few pages you could also edit your db manually

#

but that really depends on whether you care about your versions

#

like what if you would want to restore to a specific (currently stored) version in the future?

#

if not then you can delete yes

hard shell
#

It's in dev process right now the current version history doesn't matter at all, they can be deleted.

So you're saying that if I delete _pages_versions, Payload won't break? Will the Pages collection still list all the pages, even though that versions history was deleted?

west dagger
#

yes, but after that you should run a script that has payload.update({ collection: 'pages', where: {}, data: {} })

#

so payload will re-create all the versions

#

for this collection

#

you can use pnpm payload migrate:create --name update_versions

#

write this call in the up function

#

and pnpm payload migrate

hard shell
#

@west dagger any chance you could simplify this a bit? I am using npm instead of pnpm, not sure what script I should run and how

west dagger
#

just npx instead of pnpm