Wednesday, 14 December 2016

Event Store - the fromCategory projection does not work / does not project

I wrote a projection to enumerate all streams beginning "Order" and pull out how many orders were created (by having the event OrderCreated in their stream). This was a simple way of building up a projection of orders in the system.

fromCategory("Order")
    .foreachStream()
   .when({
        $init: function() {
           return { count: 0 }
        },
        "OrderCreated": function(state, event) {
          emit('newOrders', 'order', { 'orderReference' : '1' })
        }
  })


And for love nor money I could not get this to work.

In the end this answer steered me: you have to config EventStore not only to run projections but also to start the standard projections.
EventStore.ClusterNode.exe --run-projections=all --start-standard-projections=true

No comments:

Post a comment