I’m very new to mobile dev and couchbase. I’m moving my first steps with Xamarin Mobile Lite and trying to understand how to create an App that handles multiple clients. Each client will have it’s own set of documents/data but I would run a single couchbase instance.
So I’m wondering what is the best practise for doing this:
Set filters on local database and replicator to filter by client id (here is a topic showing something similar I need Couchbase Lite to CouchDB Replication
Create different buckets on couchbase server and somehow (I don’t know yet!) let gateway sync client data to the right bucket based on authentication or something
The Couchbase sync gateway lets you assign documents of one bucket to “channels”: all documents of a channel are replicated to all clients listening to / granted access to this channel.
This is done within the sync function : http://developer.couchbase.com/mobile/develop/guides/sync-gateway/sync-function-api-guide/intro/index.html
In your case, if documents are not shared between users, you can use the client id as a channel name for example.
function(doc){
var channelName = doc.clientId;
channel(channelName); // assign the document to the channel
access(doc.clientId, channelName); //grant the user access to the channel
}