addItems

Add new items to this Collection, or update existing ones if their IDs match.

// Create a new item
await collection.addItems([{
  slug: "eric",
  fieldData: {
    [nameField.id]: { type: "string", value: "Eric" },
    [ageField.id]: { type: "number", value: 47 },
  },
}])

// Update an existing item
await collection.addItems([{ id: "aBc123", slug: "bar" }])
  • If an id is provided and matches an existing item, that item will be updated.

  • Items without an id are created as new records.

  • slug should be unique.

Parameters

Returns

  • Promise<void>