Thank you very much.
" It'll update document A to a revision with no properties except for 
"_removed":true. " does this mean that I can not obtain document A by view 
or by document A's ID? or I need add _removed is not true in my view or 
query?

“the next time document A is updated the sync function doesn't grant user B 
access, then user B will no longer have access to the channel. ” If 
document A have 3 property, and each property determines user's channel. 
does this means i should write sync function like this:
if(document A have property P1 )
{access(user1,P1)}
if(document A have property P2 )
{access(user1,P2)}
if(document A have property P3 )
{access(user1,P3)}

if(document A removed property P1 )
{
  if(document A have property P2 )
    {access(user1,P2)}
  if(document A have property P3 )
    {access(user1,P3)}
}

if(document A removed property P2 )
{
  if(document A have property P1 )
    {access(user1,P1)}
  if(document A have property P3 )
    {access(user1,P3)}
}

if(document A removed property P3 )
{
  if(document A have property P1 )
    {access(user1,P1)}
  if(document A have property P2 )
    {access(user1,P2)}
}
 

  

On Wednesday, May 6, 2015 at 4:17:51 AM UTC+8, Jens Alfke wrote:
>
>
> > On May 5, 2015, at 12:53 PM, atom992 <[email protected] <javascript:>> 
> wrote: 
> > 
> > I want to know that If the user's role "role1" has been removed. what 
> happend on my couchbase Lite with document A? will document A be 
> removed(that what I want to do)? 
>
> Almost. It'll update document A to a revision with no properties except 
> for "_removed":true. 
>
> >     at the same time, I have another question about sync. My sync 
> function based on document A's property P1, If document A have property P1 
> with the specified value,user B(can be queried by document A) will assign 
> channel1. If document A's property P1 have been removed ,user B should not 
> assign channel1.how should I do to remove channel1 from user B when 
> document A's property P1 have been removed? 
>
> I'm not quite sure I understand the question. If the sync function 
> evaluating document A calls access( ) to grant user B access to a channel, 
> and then the next time document A is updated the sync function doesn't 
> grant user B access, then user B will no longer have access to the channel. 
> (Unless there is another document that still gives her access, or her 
> account's admin_channels gives her access, or she has a role that has 
> access.) 
>
> Basically, every document in SG has metadata containing a list of 
> user-to-channel grants. That list is rebuild from scratch every time the 
> sync function runs. A user's access is computed by merging together the 
> grants from all current documents. 
>
> —Jens

-- 
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/2b9ec6f0-55c8-4508-aaf5-c9e404994036%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to