We are used event types / names that basically follow this convention:
.<aggregate/entity>.
For example:
Accounting.Account.accountCreated
We store one stream for each aggregate. Because this is new for us we’re also not sure if this is best practice.
I would also like to get a stream per aggregate or domain and trying to create it by doing this for a projection:
var streamName = ‘default’;
fromAll()
.when({
$any: function(state, event){
log(event);
var positon = event.Type.indexOf(’.’)
var streamName = event.Type.substring(0, position);
}
})
.outputTo(streamName)
``
Resulting in: The test projection failed to process an event. Handler: EventStore.Projections.Core.Services.v8.DefaultV8ProjectionStateHandler Event Position: C:329547/P:329547 Message: TypeError: Cannot read property ‘indexOf’ of undefined
I can’t find any documentation about the event object passed there, so I have no clue about it’s properties and methods and I can’t use log or console.log()… So how the heck do I know what I can do with this objcet? The documentation seems to lack any information about this.