Skip to content
Warning:
You are viewing the Feeds v2 documentation. Feeds v2 is in maintenance mode and no longer receives new features. New projects should use Feeds v3, a major upgrade in performance, capabilities, and developer experience. To move an existing app, follow the migration guide.

Batch Endpoints

You can use batch endpoints to insert, delete or read multiple entries at once. These three endpoints are only available when running Stream on your backend.

Upsert

Upsert allows you to insert or update up to 1000 entries with a single API call. The payload is an array of entries. Entries that already exist (same ID) will be updated with the new version.

name type description default optional
collection string The name of the collection -
entry_id string The id of the entry, if not given an ID will be generated by Stream -
data object The data related to the user -
client.collections.upsert("user", [
  { id: "123", name: "johndoe", favorite_color: "blue" },
]);

Select

This method allows you to retrieve up to 1000 entries by ID.

name type description default optional
foreign_ids list of string The list of collection:id entries to retrieve (eg. ["visitor:123", "visitor:124"]) -
data object The data related to the user -
// select the entries with ID 123 and 124 from items collection
let objects = await client.collections.select("items", ["123", "124"]);

Delete Many

This method allows you to delete up to 1000 entries by ID.

name type description default optional
collection string The name of the collection -
ids list of strings The list of id to remove -
// delete the entries with ID 123 and 124 from visitor collection
client.collections.deleteMany("visitor", ["123", "124"]);
Info:

When you delete an entry from a collection any references will be converted to a missing reference error when reading feeds with enrichment.