TTL propagation throughout all devices?

Hi all,

I am using Couchbase Server + SG + Couchbase-Lite on Android.

I’ve read about setting TTL to documents in Couchbase Lite. That works great. I’ve read all about Tombstones and _exp etc.
It seems that there is no simple way to delete/purge a document and let the system handle the propagation of that operation. Is that correct?

Here’s my use case: I have a simple todo app. The user is allowed to delete tasks. When a task is deleted I want to propagate that change to all other devices and purge the document permanently. That will save bandwidth and battery to the user. How can you do that using SG + Couchbase Lite?

Purge operations are designed to not replicate, but deletes are. So this means if you were to delete the document first, wait until it syncs to the server, and the purge it then you should achieve your desired effect.

Thank you for responding!

Ok, delete locally and purge after sync with SG. What happens if the document is purged locally and then a sync with SG is made? Isn’t that same document (previously purged locally) gonna end up in the documents of the local database?

Only if the document is further changed (i.e. undeleted) or the sync starts over from the beginning (from a call to reset or a failure to agree on the last sequence [which is rare])

A deleted document doesn’t take up much room. Maybe 100 bytes or so in the database. For a to-do app, it seems unnecessary to worry about the overhead. If you’re deleting zillions of docs, then it’s time to consider purging them :slight_smile:

I agree with you. However, whether or not you have to worry about the overhead is application specific. There’s no way for you to know the whole context surrounding the app we’re talking about :slight_smile:

So, there is no 100% reliable way to do this? Will Metadata Purge Interval in SG 1.5 be of any help regarding this case?

Thank you for your time!

Purging the document after the deletion is replicated is reliable.