Filter documents for each client mobile

How to filter the necessary and sufficient data for each mobile phone?

Indeed, the database of the server can be important to manage many customers but not on the phones which must only contain useful data for the customer having the phone.

Thanks for reading

Use import filter to specify the subset of server side documents that you want imported by Sync Gateway and processed for sync to mobile clients. Only documents imported by Sync Gateway will be available for sync to the mobile clients. More on shared bucket access and import processing discussed here.

Leverage Sync Gateway channels to segregate data and enforce access control on a per user basis. If there are private documents associated with each user, then create a channel per user. If you have common documents shared across users, create a shared channel or just put documents in the public channel. In your sync gateway sync function, assign documents to channels based on suitable criteria.


Filters is not the solution for me.
And not ‘tag’ also.

I read this solution:

"sync": `
  function(doc, oldDoc) {
      if (doc.tag !== undefined) {
          channel("CHANNEL_" + doc.tag);

wich is use with authentification :

"users": {
  "test1": {"password": "tag1", "admin_channels": ["CHANNEL_tag1"]},
  "test2": {"password": "tag2", "admin_channels": ["CHANNEL_tag2"]}

But I can’t write user authentification for all the users of my mobile application.

Let me explain : my application have clients who sell products to customers.
So client have to see only their customers and their products. Also, they have in local dabase only them : for space issues and also security and privacy, etc…
Customers can have access to products but with less informations than clients, and also they should have on local database only necessary data.

My issue is that if I read right I should create authentification for all my application users.
Seems very strange.

Does exist a solution ?


:rage: Please take a look to my other topics : Sync 1 objet and only 1 for each client on mobile application

Are you agree ?