How to sync a specific channel with ionic2, couchbase lite 2.0 and sync gateway 1.5

Hi, I’m following the tutorial on
it says to replicate the following way:
this.database.sync(“”, true);
I use sync gateway 1.5 and couchbase lite 2.0 via the Couchbase-Lite-PhoneGap-Plugin
My docs all have a “channels” property with a list of channels.

How do i only sync specific channels?

also see

Ionic/Cordova isn’t supported in Couchbase Lite 2.0 …as yet. That blog post is for Couchbase Lite 1.x which leverages the REST API supported by Couchbase Lite 1.x. That API does not exist as yet on 2.0. Also, note that the replication protocol between Couchbase Lite2.0 and Sync Gateway 1.5 is completely new - It is not longer http. I

Please check this link for list of platforms currently supported on Couchbase Lite 2.0

Ok, thanks for clearing that up.
Looking at the matrix at
it seems that it should work…?

So could you explain my question about channels with couchbase client 1.4 then?

That matrix is for Couchbase Mobile 1.4. You were trying out with Couchbase Mobile 2.0.

I believe that the filter param on the POST replicate should accept a comma separated list of channel names on which you want to filter. I’m not so sure though - Tagging @jens - Is there a channels param?

In the POST to start the replication, add the JSON properties: "filter":"sync_gateway/bychannel", "channels":"ABC,NBC,CNN,FOX".

Looks like the docs need to be updated to reflect the above. I have filed a ticket for the same

For anyone else lead here by google I just wanted to share my own experience with channel filtering.

It seems as if the information given by @jens is only partially true for the current version 1.4.1 of CBLite. According to the docs the channels parameter must be wrapped into a query_params object. As a result an example for a correct JSON body would look like this:

    "source": sourceUrl,
    "target": targetDB,
    "continuous": true,
    "filter": "sync_gateway/bychannel",
    "query_params": {
        "channels": "ABC,NBC,CNN,FOX"
1 Like