> On Mar 11, 2015, at 4:18 AM, Souhail Marghabi <[email protected]>
> wrote:
>
> I am new to couchbase Mobile and I am developing an iOS app with couchbase as
> a backend. I have a object called Survey which has another object called
> "Profile" as an attribute. When syncing I want to make sure that the survey
> data gets only synced for the specific "profile" that applied change to it.
> in Other words how to make that we sync only and retrieve only the related
> data for the current "profile" / user using the app.
In the sync function:
requireUser(doc.profile);
channel(“profile-“ + doc.profile);
The first line ensures that only the user named in the ‘profile’ property can
change the document.
The second adds the document to a channel named after the profile. Then you
need to configure your user accounts so each has access to the channel with the
corresponding name, e.g. for user “foo” add “profile-foo” to the admin_channels
property.
—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/533BC69C-4862-49A6-BC08-14F83F9ABCF7%40couchbase.com.
For more options, visit https://groups.google.com/d/optout.