In Memory Event Store

Hello, i am starting learning about ES and EventStore.

I have a doubt about starting an in memory event store node. To do that, i am running the next command:
“c:/EventStore/EventStore.ClusterNode.exe --run-projections=all --mem-db”

As i understand, it should start a clean instance without any previous data.
I am using it in order to run some learning tests, and start from scratch whenever i think i learned something.

I am having a non expected behavior when i create a new stream with the same name from previous tests, ran in another in memory instance.

For instance, I create a new event AccountCreated with no data, for a new stream “Account-1”.
Then when i navigate to that event, i has some data, apparently form previous examples, and also, it has some feature events linked in the same stream.

For doing it, i am using the event store UI.
I attached a gift with the example.

I hope i am not asking a stupid question.


I wonder if it’s the browser caching.
Can you repeat the test, but before you check the after the restart, clear the browser cache.

Yeap! you are right! I test it with an incognito view, and it works as expected!

Another quick question, when I define projection handlers for each event, i saw some examples where they return the updated state, and other doesnt do it:

when({ someEvent: (s, e) => {s.count +=1; return s; }})
when({ someEvent: (s, e) => {s.count +=1; }})
when({ someEvent: (s, e) => {return {count: s.count + 1}}})

What is the implication of this?
Is expected to return something, or just update the received state is the expectation of each handler?

Thanks a lot for the help :slight_smile:

To be honest, I don’t know the difference between doing s.count+++ and return s; etc
I always assumed no difference at all, but thats just me probably not fully understanding the mechanics of this.

In my projections, I set my state directly, like:

s.count ++;

And don’t return

Do you view the state changes via the UI. I would be interested to hear what actually happens in these situations.

Returning updated state and updating without returning work perfectly.

I will try the 3th option right now

3th option looks also good.

Maybe it will be easy to test because of the immutability.

We use a testing framework for projections which I think enforces us occasionally to return the state actually.

nice thanks for the info!
I still have have a lot to learn!

1 Like