> On Oct 27, 2014, at 6:57 PM, Guofeng Zhang <[email protected]> wrote: > > Similar to this demo, my app have a long live chat room, but I only want the > part of the messages for this room be synced to devices. I can do it by > defining the syn function to only sync the messages before some day, for > example, only the messages in last 30 days could be synced to the devices.
That won't work. The sync function sees a document only when the doc is updated. If the doc isn't updated for 30 days, it's no longer 'current' but the channels it's in won't change. What you can do is to assign channels on something like a monthly basis — for example channels named 2014_07, 2014_08, 2014_09… Then you assign a doc to the channel based on the year/month it was last updated. The clients can now sync with the latest one or two months' channels to get only the recent documents. > But there is a problem to view the other messages that not synced to devices. > for example using pull-to-refresh to view the old messages. What I could > consider is to use our own app server to fetch these old messages page by > page. I just posted about that this morning <https://groups.google.com/d/msg/mobile-couchbase/N_0phI74OIA/AiNm-lbCpHwJ>; hopefully that message will be useful. —Jens -- You received this message because you are subscribed to the Google Groups "Couchbase Mobile" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/mobile-couchbase/B604AF27-9737-4232-B080-338A3C8DC39E%40couchbase.com. For more options, visit https://groups.google.com/d/optout.
