Collections
Confused about "Collections"?
Let us know how we can improve our documentation:
Collections enable you to store information to Stream. This allows you to use it inside your feeds, and to provide additional data for the personalized endpoints. Examples include products and articles, but any unstructured object (e.g. JSON) is a good match for collections.
Collection entries can be embedded inside activities and used to store nested data inside activities. When doing so, Stream will automatically enrich your activities with the current version of the data (see later section). Collection endpoints can be used both client-side and server-side except the batch methods that are only available server-side.
Adding Collections
Copied!Confused about "Adding Collections"?
Let us know how we can improve our documentation:
This method allows you to create a new entry on a named collection.
Parameters
Copied!Confused about "Parameters"?
Let us know how we can improve our documentation:
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 | - |
Retrieving Collections
Copied!Confused about "Retrieving Collections"?
Let us know how we can improve our documentation:
After adding an entry to a collection, you can also retrieve it easily by its ID.
Parameters
Copied!Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
collection | string | The name of the collection | - | |
entry_id | string | The id of the entry | - |
Removing Collections
Copied!Confused about "Removing Collections"?
Let us know how we can improve our documentation:
An entry can also be removed from a collection with its ID.
Parameters
Copied!Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
collection | string | The name of the collection | - | |
entry_id | string | The id of the entry | - |
Updating Collections
Copied!Confused about "Updating Collections"?
Let us know how we can improve our documentation:
A collection's entry data can be updated. Updates are propagated instantly to all activities embedding the entry.
Parameters
Copied!Confused about "Parameters"?
Let us know how we can improve our documentation:
name | type | description | default | optional |
---|---|---|---|---|
collection | string | The name of the collection | - | |
entry_id | string | The id of the entry | - | |
data | object | The data related to the user | - |