Enrichment

Enrichment of Collection Entries

Objects stored inside collections can be embedded inside activities or user objects. This allows you to integrate with Stream without building a complex integration with another database. Stream’s collections can be used as your data source for data enrichment.

# first we add our object to the food collection
cheese_burger = client.collections.add(
  "food",
  data={
    "name": "Cheese Burger",
    "ingredients": ["cheese", "burger", "bread", "lettuce", "tomato"],
  },
)

# then we embed a reference to the entry we created before
user_feed.add_activity(
  {
    "actor": "jim",
    "verb": "grill",
    "object": client.collections.create_reference(
      "food", cheese_burger["id"]
    ),
  }
)

# if we now read the feed, the activity we just added will include the entire full object
user_feed.get(enrich=True)
© Getstream.io, Inc. All Rights Reserved.