I have a phonegap-plugin based android group chat app, and I want to make user in the same group can sync message.but I only want to sync the message that created time posterior to the time that user join into group.
so In my doc design, I have some docs like:
group doc
{"_id":"group001","type":"grp","members":["user1:20150617","user2:20150620","user3:20150710"]}
which members's field is came from:<user_id>:<join_time(for simplified let's assumption the time format is YYYYMMDD)>
{message doc}
{"_id":"msg001","type":"msg","create_time":20150618,"user_id":"user1","body":"hello"}
{"_id":"msg002","type":"msg","create_time":20150621,"user_id":"user2","body":"hi"}
{"_id":"msg003","type":"msg","create_time":20150711,"user_id":"user3","body":"nice to meet you"}
what I want is
for user1 can receive msg001/msg002/msg003;
for user2 can receive msg002/msg003;
for user3 can receive msg003;