Hi,all
    I have a trouble in changing access of channel,:
I have three docs:
doc A like this:{"type":"typeA","key":"keyA"}
doc B like this:{"type":"typeB","key":"keyB"}
doc C like 
this:{"type":"typeC","key":"keyC","refer_id":"keyA","user_id":"user1"}

and one user:user1 with no roles and admin_channels in sync gateway.

following is my sync function(guest user is disabled):

function(doc,oldDoc){
  switch(doc.type){
    case 'typeC':
        channel('u-' + doc.user_id);
        access(doc.user_id,'u-' + doc.user_id);
        if(doc.refer_id){
            access(doc.user_id,'b-' + doc. refer_id);
        }
    case 'typeA':
        if(doc.key){
          channel('b-'+doc.key);
        }
    case 'typeB':
        if(doc. key){
          channel('b-'+doc.key);
        }
  }
}

when I send sync from sync to  CBL with user1's Cookies, I can get the docA 
and docC.
but when I changed docC to:
{"type":"typeC","key":"keyC","refer_id":"keyB","user_id":"user1"}
I want to get the docB and docC(docA should not be sync to CBL). but I get 
docA,docB and docC.
I want to know how can I only get docB and docC when I changed docC(changed 
refer_id from keyA to keyB)?



-- 
You received this message because you are subscribed to the Google Groups 
"Couchbase Mobile" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/mobile-couchbase/1a52a5a0-a439-474c-92d9-020fd0c57ceb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to