I am streaming all events in my EventSTore with this:
eventStore.Advanced.GetFrom(DateTime.MinValue).ToArray().SelectMany(its => its.Events).ToArray();
Keeping the paging at the default 128 limits the number of events fetched at 2989. When I increase the paging size to 9000 I get all the events as I expect (there are around 7K events).
What is the best way of making sure I am getting all the events; ie when rebuilding view models?
BTW I am still on ES 2.0 Thanks!
There's the a bug in EventStore v2.0 related to paging that's causing the behavior you're seeing. EventStore v3.0 fixes this bug. Also, I would definitely avoid the .ToArray() on that call because if you have 100K+ events, you're asking for an OutOfMemoryException.
Once you're on EventStore v3.0, you can call GetFrom and iterate through the events and do something on each event, like update a set of DB tables, etc.