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.

Omitted top-level fields remain unchanged. Supplied arrays replace their items and nested field data; include everything to keep. Reuse array item IDs to preserve matching localized values, or omit IDs to create new items. Each provided array item ID must be unique within that array value. Pass value: [] to clear an array.

Parameters

Returns

  • Promise<void>