[Couchbase lite 2.8.4] - purging tombstones in cbl

Hello everybody,

Is there a way to purge tombstones in cbl ?
In sync gateway document I can read “Purging of tombstones is also required on Couchbase Lite. For example, you might decide that if a document is deleted on a Couchbase Lite client, that you want to purge the document (on that device) as soon as the delete has been successfully replicated out to Sync Gateway.”

How can I know that the delete replication has been well performed ?
Or could it be a good solution, in a period task, to parse all deleted document in the local database, using the meta.deleted flag in a where clause of N1QL query, and to purge them ?

Please take a look at the example for purging docs on cbl side.
https://docs.couchbase.com/couchbase-lite/current/android/document.html#document-expiration

Once docs are purged on SG, we need to have a periodic task to parse and delete the docs on SG side.

1 Like

purge action should handled by cbl when a tombstoned document from sync gateway gets replicated. this probably is what you are looking for:
https://docs.couchbase.com/couchbase-lite/current/java/replication.html#document-access-removal-behavior
and you can query them using cblite query:
https://docs.couchbase.com/couchbase-lite/current/objc/querybuilder.html#lbl-deleted-ops

While if you wish the tombstone documents do not get auto purged on cbl, you can add AccessRemoved flag to your replicator will be added to the document. if you wish this document is not been purged automatically, you can set a filter to your replicator configuration.

https://docs.couchbase.com/couchbase-lite/current/swift/replication.html#pull-filter

1 Like

Hello,

Thanks both for your replies !

Regards,
David