How to not sync some docs from couchbase lite

Hi,

I have some nformations I want to keep locally in the mobile device. As I have a couchbase lite, I want to save them as a document.
I don’t want that sync gateway take this informations and put them into my bucket.

How to do that ?

Regards

Steeve

Which version of CBL are you using ?

In 1.x, you can use filter function on replicator

In 2.0, I don’t believe we have the filter function as yet. But you could use documentIds to specify exactly the Ids to want to replicate.
Another option would be to create a local only db for such content that is not synced to a remote db.

Hi,

I’m using couchbase Lite 2.0, DB21.

I can put all the informations I don’t want to sync in a unique document.

Regards,

Steeve

Hmm…but that may not really help because the documentIds associated with replicator are to specify which docs to replicate (and not the ones to filter on).

Of course you could have your sync function ignore these documents so it does not replicate but I suspect you don’t want this to leave the device.

Any reason you can’t put this in a separate CB lite database that’s not being replicated ?

@jens Are we going to have the filter function in 2.0 ?

I think it’s a bit complicate to manage a second database just to store some infos.
But, I could do that, hoping It will work without interfering with the other database.

Once again, it’ fun to start a project with couchbase and xamarin in c#, but it’s not so simple.

I was hopping for a simple solution, like : Create your doc with a special constuctor and put the sync boolean to false. The replicator will ignor it.

Simple, clean, easy … I’m a dreaming ?

Thank you

Actually , apart from the couple of lines needed to create the DB, from the app perspective, interacting with it from should be no different than interacting with the one that syncs. That’s the beauty of the solution and makes it future proof (if you want to add more local only content) .

I get it. We used to have concept of local documents in previous versions of 1.x but that never really got much traction with that so we dropped that in 2.0 .

It’s very easy to do that with a push-replication filter — just use a filter that returns false if the doc body has that property value — but unfortunately that feature was dropped from 2.0 because of schedule constraints. We do want to add it back soon.