How to perform "Document Access Removal Behavior"

I went through this document, but unable to remove document access on the sync gateway.

FYI: I’m using Couchbase Lite 2.8.6 on the mobile (Xamarin SDK)


  "channels": [
  "docType": "logentry",
  "creator": "14bd9d1d7a",
  "createdOn": "2022-03-30T13:37:42.5070600-04:00",
  "subjectId": "14bd9d1d7a",
  "modifier": "14bd9d1d7a",
  "modifiedOn": "2022-03-30T13:37:42.5070600-04:00",
  "deleter": null,
  "writers": [
  "sequenceId": "0",
  "_id": "evt..14bd9d1d7a..69856d73a",
  "_rev": null,
  "_deleted": false,
  "insert_id": "evt..14bd9d1d7a..69856d73a",
  "device_id": "5E634E1C226",
  "user_id": "14bd9d1d7a",
  "event_type": "Signup",
  "origin": null,
  "time": 1648661795504

sync function:

if (doc.docType === "logentry") {

I expected that by doing this in sync gateway, the channel is updated and the user doesn’t have the access to logentry channel so the document will be purged. But I still see the documents in the device (phone) CB Lite. Based on the documentation, an event is triggered and those documents are purged, which isn’t happening.

Based on the document here:

### Auto-purge on Channel Access Revocation
Previously (**before v3.0**) these documents remained in the local database

Prior to this relese, CBL auto-purged only in the case when the user loses access to a document by removing the doc from all of the channels belong to the user. Now, in addition to 2.x auto purge, Couchbase Lite will also auto-purges the docs when the user loses access to the doc via channel access revocation. This feature is enabled by default, but an opt-out is available.

Does it mean that the user would still have access to those document? If yes, then

  1. what is the “auto purge” really doing if its not removing access?
  2. After the app is relaunched user is not able to access those docs, is this expected?
  3. Can anyone suggest how I can remove document access and subsequently purges the document from the database?

You can find more detailed description in EnableAutoPurge property in the API doc: Class ReplicatorConfiguration

EnableAutoPurge isn’t available for v2.8.6 (Xamarin SDK). Is it possible to auto-purge in v2.8.x?

EnableAutoPurge is the new feature added in CBL version 3.0. Not available in CBL v2.8.x or less.

Thanks! So autopurge functionality doesn’t exist in v2.8.6 ?

As Sandy mentioned, auto purge on channel access revocation is available starting 3.0. So not in 2.8.6.

3.0, as in CBL3.0 or both CBL 3.0 and sync gateway 3.0?

CBL 3.0 and SGW 3.0. Auto purge on channel access revocation includes changes to underlying sync protocol and requires both to be on min version of 3.0.

1 Like