my whole sync function like this:
function(doc,oldDoc){
if(doc.type == "type1"){
if(doc.key_id1){
channel('u-' + doc.key_id1);
}
}
if(doc.type == "type2"){
if(doc.key_id){
channel('b-'+doc.key_id);
}
}
}
If I use switch I get right result.
On Tuesday, May 12, 2015
Weird — is that your sync function exactly as present in the config file?
Because my guess is that there’s a typo in one of the places you put “key_id”,
even though that isn’t showing up in the code you posted. Because it’s clear
that the variable key_id in the channel(…) call is undefined.
You
Hi,all
I am using sync gateway 1.0.4, my sync function like this :
function(doc,oldDoc){
if (doc.type == "MESSAGE") {
if(doc.key_id){
var key_id = doc.key_id;
channel('k-'+key_id);
}
}
}
and my doc like
this:{"id":"MSG001","type":"MESSAGE","key_id":"key001","body"