First Event in Aggregate Stream

I notice that the event store repository samples in the documentation and GitHub differ over the position to start reading a stream from.

In the documentation the code in GetByID is:

var sliceStart = 1; //Ignores $StreamCreated


Whereas in GitHub the code in the same position in GetById is:

var sliceStart = 0;


So, the documentation sample ignores the first event in a stream when rehydrating an aggregate. I assume the reason is that, for example, a FlightCreated event doesn’t need to be replayed when an aggregate is being rehydrated. But it raises the question for me: what is the general practice with event sourcing and aggregates? Do people recommend raising an event that broadcasts that the aggregate has been created? Do you then ignore that event when rehydrating the aggregate?

not a bug its a historical thing, 1.0 put a $streamCreated event in
the stream. Any version after 2.0 does not have this behaviour

A somewhat related question: should an aggregate’s version take into account an event that announces its creation?

So, for example, if we have a Product aggregate we create a new one which raises an event ProductCreated. We then update the product name (which raises a ProductUpdated event) and persist the aggregate to the EventStore. When we rehydrate the aggregate what should that aggregate’s version be?

I notice the sample project in GitHub throws an error if you try to retrieve version 0:

if (version <= 0)

throw new InvalidOperationException(“Cannot get version <= 0”);


But if there is no longer a $streamCreated event created by EventStore then surely asking for version 0 is valid since it is the state of the aggregate just after ProductCreated was raised.

Yes since there is no longer a $streamCreated

Thanks, Greg. So, semantically speaking, it’s normal to speak of “version 0” of an aggregate?

im not sure what you mean.

So, I just mean that in general when referring to an event-sourced aggregate we should speak of it being at version 0 when it has been created (and raised a ThingCreated event)?