Sync Gateway pass-through view

In Couchbase Connect 16, I heard the term “Sync Gateway pass-through view”, is it the same as the unsupported.user_views, or different?

Regardless, is there any way to make querying through Sync Gateway continuous (i.e. essentially listen to any change of the result set for query against Couchbase Server and pull the diff to the client), similar to LiveQuery against Couchbase lite on the client side? I ask this because it’s very undesirable (either too much undesirable docs being downloaded and take local storages space, or expensive operations needed) to use channel and access control to filter docs on server in my use case.

The mechanism to get notified of changes on Sync Gateway is the changes feed. As you’ve noted, the Sync Gateway changes feed only supports channel based filtering (filter=sync_gateway/bychannel). Why is that undesirable?

Thanks for your reply. My mobile app will either need to have too many channels (could be on the order of 10 million or more) to let users only get what they need, which can cause considerable performance hit to the sync gateway server (based on what I heard from SG experts in connect 16 ), or to have less channels at the cost of letting most users download more (and could be a lot more) docs than they actually need and deal with the tricky “purge-but-not-forget”. I really want to avoid this trade-off as it seems to me the app won’t be very scalable (and maintain good user experience) whichever trade-off point I pick.

Could the “GET /{db}/_changes” at following link be used by many mobile app users concurrently? If so, how about let the doc ID includes all the info(i.e.fields) I need to continuously query against, let the client check the docID and rev in the response result and decide whether a doc (or a revision of a doc) need to be downloaded?

https://developer.couchbase.com/documentation/mobile/1.1.0/develop/references/sync-gateway/rest-api/database/get-changes/index.html

I’d love to hear any other idea (even a hack is welcome) to somehow effectively do LiveQuery-like query through sync gateway?

Thanks.

Could the “GET /{db}/_changes” at following link be used by many mobile app users concurrently?

This is what replications in continuous mode do. Out of curiosity, why not use continuous replications?

I’d love to hear any other idea (even a hack is welcome) to somehow effectively do LiveQuery-like query through sync gateway?

Currently, there are no plans to have a LiveQuery-like feature on SG but the closest to it might be a _changes feed request with feed=longpoll/continuous and filtering the document ID. This is not implemented yet but it is being considered in #1703

Channel is the only mechanism to filter docs in a continuous pull replication, right? As I discussed in my last post, in my use case, I would end up either having too many channels or letting users download more docs than they need — neither is desirable.

Seems like using “_changes feed request with feed=longpoll/continuous and filtering the document ID” could work for me. I couldn’t find any info about it other than this link: https://developer.couchbase.com/documentation/mobile/1.1.0/develop/references/sync-gateway/rest-api/database/get-changes/index.html

If you could point to some sample code (Android would be ideal) and/or more detailed documentation/tutorial about implementing this (e.g. should this be running on a separate thread? what are things need to be watched out for), that would be much appreciated !

“_changes feed request with feed=longpoll/continuous and filtering the document ID”

Except filtering on the document ID is only possible in a one-shot replication currently.

You could try using longpoll without filtering anyways and ignore the documents you are not interested in. I think it’s the only way to do what you are asking for. (@adamf is that a good recommendation?)