Found something interesting that some people might get tripped up on.
I used the default sync function:
function(doc){
channels(doc.channels)
}
I added the below document into SG with "channels":"bob"
{
“_id”:“12345”,
“channels”:“bob”
}
And when I tried to filter by channel via
http://hostname:4984/{db}/_changes?filter=sync_gateway/bychannel&channels=bob
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 and filters by only docs in the “bob” channel.
{
“_id”:“12345”,
“channels”:[“bob”]
}
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?