How to prevent local doc from sync'ing



I would like to store all the data used in my app inside the same database. However, some of the information I may not want to sync. back to the server.

As an example I would like to create a “Configuration” document that would hold various user specific settings related to e.g. the user interface (could be language selected by the user). But I don’t really want to sync. that info back to the server (in this case I would have one “Configuration” document for EACH user in the system - so not even a unique key).

I appreciate that I can test for “write access” in the sync formula on the sync gateway - but I already know that this data shouldn’t be sync’ed - so is there a way to tell the local replicator not even to bother sending the information as we know it will be rejected - so we can avoid using the extra bandwith?


In CBL 1.x you can set a push filter on the replicator, a callback that can choose which documents should be pushed.

Unfortunately CBL 2.1 doesn’t have that feature, but it’s planned to be restored in the next feature release. (Sorry, it’s too early to quote a release date or offer a preview build!)

At the moment the only workaround in 2.x is to put those documents in a separate database. :frowning:


Hmmmm… Ok. Thanks for your reply…

Good that it is going to be restored as there obviously are scenarios where it makes sense to avoid the extra network traffic.

I’ll work around it following your advice.