We are having a peculiar case where One Person moves from one state to other. So in mapper we are emitting who is in which state. Following is how we are emitting documents
The data in the CBL key will look like as follows:-
but now when the User moves to other state say State2 the key will be emitted as
Now if I see people in State 1 on 2017-07-24 date then I will see 1 count and on state 2 I will see 1 count.
But the actual count is 0,1 for state-1 and stat-2 respectively.
Can you suggest how older key can get replaced by the new key. Or what should be the design of emitted key.