feliun/event-sourcing-poc

Add projections

Closed this issue · 3 comments

From the commands in the store I would like to build another collection besides the book. I want it to be called authors and have a structure kind of like this:

{ 
    "_id" : "Felipe Polo", 
    "book_cnt" : 1, 
    "total_amends_cnt" : 1
}

In my mind and from my experience I would create another projection that projects the commands like this and then run reindex and then the new collection should show up.

Question is: How would I approach this? And how can we add this to the POC since this will be a very common thing to do.

@mattiasmak is authors a different piece of information collected initially?

It could be. Or it could be at a later stage as with most software you realize later on that you need the data in another structure as well.

It's one of the most important pieces. And it may work already, but I haven't figured it out yet.

@mattiasmak solved in #2