setAttributes

setAttributes

setAttributes

Set the attributes of a Collection field.

const updatedField = await field.setAttributes({ name: "Better Name" })

if (field.type === "file") {
  const updatedField = await field.setAttributes({ allowedFileTypes: ["mdx"] })
}

Params

  • attributes: UpdateFieldAttributes<typeof field> – The updated attributes for the field.

Returns

  • Promise<typeof field | null>

Caveats

  • May return null if the field was deleted before this method was called.