Sync Gateway filtered by multiple channels

I understand that you can specify a list of channels in Couchbase Lite so that you will only sync with docs that are part of that channel.

However is it possible to filter out docs unless they are part of 2 or more channels?

For example I keep a manifest in the database for each client. The manifest exists in 3 different states: last, current and ideal. The client also has it’s own channel which is the name of the client’s id.

I’d like to set it up in a way that the replication filters out all docs unless they are part of the client’s channel AND the “ideal_manifest” channel.


have you tried creating a ideal_manifest_for_Client_1 channel? You can probably do that according to your business rules in the sync function.

The combined channel name would do the trick but more likely to result in a huge number of channels which would be difficult to manage.

It would be great if the sync gateway could allow filter by the intersection of two or more channels.

Just starting to get familiar with Couchbase Mobile, and I’m interested in this type of channel intersections too. I’ve read through the documentation but couldn’t figure out a way to do it.

The suggested method of generating a unique channel name for every possible combination of intersections can get out of hand really quickly. For e.g. with 4 channels one will end up with 15 combinations.

Is there a nicer way to do this?