addFields

Create new unmanaged Collection fields.

const createdFields = await collection.addFields([
  { type: "string", name: "Name" },
  { type: "enum", name: "Status", cases: [{ name: "New" }, { name: "Done" }] },
  { type: "file", name: "Text", allowedFileTypes: ["md"] },
  { type: "collectionReference", name: "Author", collectionId: "ASh5SZOh" },
])

Use Field.setAttributes to update existing fields.

Parameters

  • fields: CreateField[] – The array of fields that should be added to the collection.

Returns

  • Promise<Field[]> – The newly created Field instances.