#Remove fields in Payload migration? (MongoDB)

2 messages · Page 1 of 1 (latest)

valid glade
#

When removing a field from the collection schema, it doesn't get removed in existing MongoDB documents. I'm already using migrations to migrate data when changing the schema, so I thought it would be easy to remove fields in the migrations too.

I tried settings the field to undefined in a payload update, but that didn't work. I also tried removing the key from the object and updating with that entire object.

Does anyone know how to do it? I'm using Payload v2.32.2.