Managing read state in event sourcing: How to prevent duplicate data when adding new events?

How does one manage read state within an event sourcing infrastructure ? Lets say I receive a new event to add a user. Before I can add the user to the event store I will need to ensure the user does not exist. Considering event stores can’t be queried like a normal RDBMS, how would I aggregate the events into such a way that I am able to query it ?

I was planning on using live projections and have a variable called “state” which can be looped to see if the aggregiate exists but I am not sure if it offers realtime updates or whether it might be too slow which could give rise to duplicates.

Please advise

There are a few possibilites over here : Problem: Patterns for something something must be unique · Issue #28 · ylorph/The-Inevitable-Event-Centric-Book · GitHub