Basically, you store all of the data as events (event sourcing) and create separate query views (projections) which are populated from event streams.