SG - filter by channel works with arrays only


Found something interesting that some people might get tripped up on.

I used the default sync function:


I added the below document into SG with "channels":"bob"


And when I tried to filter by channel via

it returned an empty array

When I tried http://hostname:4984/{db}/_changes?filter=sync_gateway/bychannel&channels=*
with a “*” , it worked but I got all the documents in the DB.

But when I changed it to "channels":["bob"] an array everything worked fine :+1: and filters by only docs in the “bob” channel.

It accepts one or more arguments, each of which must be a channel name string, or an array of strings.

In the docs when it talks about channels( ) its not that clear about arrays and filter by array only or is that a bug?



This looks like a bug to me - the channel() function is supposed to support both cases, as documented.

@househippo Can you file a github issue for this?