I am moving from CouchDB to Couchbase+Sync Gateway and I am not clear on
how to set up the user-data architecture.
Users will never share information with each other, so I need to keep their
data separate.
In my CouchDB architecture, I am creating a database per user, so a user
can only see their documents.
I understand that in Couchbase you use channels to allow access to a subset
of the documents.
I want authenticated users to insert documents and be automatically added
to the user's channel without having to modify the client to provide
doc.owner
Let's say that my client authenticates to Couchbase (username: myuser1),
then using the sync_gateway's sync function, I want to map all documents
inserted by myuser1 to a channel named myuser1.
Can I make the sync function do that automatically? (Reason being I want
the session to determine the channel)
Example:
function(doc) {
channel(authenticatedUser.name) //sets the authenticated username as the
channel name
}
Or must I force the client to set the attribute doc.owner?
Example:
function(doc) {
requireUser(doc.owner)
channel(doc.owner);
}
--
You received this message because you are subscribed to the Google Groups
"Couchbase" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.