We want to use ESDB to model our order entity. An order has a shipment date, which can change n times after the order has been placed. The events are called
orderDeliveryDateChanged resp. and both contain a shipment date. In order to show a list of all orders for a given date in a backoffice application we created a projection that partitions by shipment date:
fromCategory('orders').partitionBy(e => e.data.shipment && e.data.shipment.date).when().outputState()
Now because the partitioning happens based on the events, not an aggregated state, an order which had its shipment date changed n times will show up in as many streams, not in only one.
Is there a way to partition a projection based on an aggregated state? Are projections the right approach here?