As you may know, I have been studying couchdb, specifically its ability to replicate your data and trying to get a better understanding of how all this works. I have modeled out the basic data flow for selective, or filtered replication of the data and I have attached the diagram below. I will give a little bit of an explanation of what is going on here to hopefully make more sense of how things are going to work.
We have an admin tool that would most likely reside on a web server somewhere that will have the ability to do the standard CRUD operations on users as well as the standard CRUD operations on the couchdb documents for filtering the data. Those changes will all go into a database that is housed on the main server on a per organization basis, say its your local store and the Master DB is your HQ. That is the admin piece, now on to the server side..
The server, or Master DB will just be the central repository of data, the filters in my current idea will all sit in the Filtered DBs and we will let those filtered DBs make all the decisions on where the data goes when it comes to the server.
The client will have the full ability to create all the documents on the local or client side for simplicity at this point. (I am defining the client as an actual application that will reside on the desktop, mobile device, whatever) The Filtered DB will grab all the data from the client and hold it for filtered replication to the server later, this would seem to be a nice way to have a backup of your local data. The idea at this point is to have the client side create the filtered DB on the server side which is simple enough via couchdb.



