Sync Gateway support the concept of channels which allows you to shard the documents in a DB so that users only receive the subset that is of specific interest to them.
Yes. Actually I wanted to ask, what if the users own data grows beyond a certain threshold (ex: location history GPS coordinates taken at certain interval) syncing the whole data set would not be ideal in that case. Is there a way to sync only a selected subset of data; and bypass sync gateway and talk to couchbase server for other parts of the data?
Bypassing sync gateway will confuse the sync gateway and its not recommended. If a document goes through sync gateway then it adds some meta data which allows sync to happen. If you change data directly on the server guarantee of sync is not available.
For something like time-series data that grows indefinitely, one way to treat it is to cycle through channels. So, for example, you could have monthly channels (May.2017, June.2017) and update a clients access on a regular basis. Combine that with purging older data.
Does that fit with what you have in mind? I think you were suggesting you’d write the time series data straight to Couchbase Server. If you don’t care about mobile clients receiving that data back, you could, although you can get the same effect by allowing a client to write to a channel they can’t read. (That’s a trick that isn’t obvious. Just because a client writes a document, doesn’t mean it automatically can read it back. See this blog post for a discussion.)