Projections Intermission - Emitting new Events Based on Time

I’m messing around with event store right now, importing events from an ecommerce system. I would like to figure out things like cart abandonment rate or bounce rate.

In this sample it looks like the ‘secret sauce’ is the IntervalOccurred event. Of course this already needs to be in your stream to make it work!

How to emit ShoppingCartProbablyAbandoned if ShoppingCartItemAdded and no CheckoutCompleted is in the stream after a day?

No need for an interval event there. Let’s say we had two events (ItemAdded and Checkedout). On item added we would presume the cart to be abandoned unless we received a checkedout.


ItemAdded : function(s,e) { s.Abandoned = true; }

CheckedOut : function(s,e) {s.Abandoned = false ; }

We could then just return our state as the result of our projection. Results are in dev branch now. There will be a blog post coming shortly on this.