Search code examples
strftimegetstream-io

getstream aggregate feed - group by time with strftime


My goal is to aggregate activities together, but only if they happen within x amount of minutes within each other.

It looks like I need to use the strftime syntax. Using this syntax is it possible? I am also confused about which activity property I assign this group string to.

Thanks!


Solution

  • You can use strftime to ensure activities that happen in the same hour or in the same day are grouped together. It needs to be a fixed window though, it can't be based on the distance between activities.

    This blogpost explains the underlying system for aggregation: http://blog.getstream.io/aggregated-feeds-demystified/

    Note that on enterprise plans we can setup custom aggregation formats that can handle more complex use cases. (such as the grouping you're looking for)