How to implement 'soft delete' of Couchbase document

63 views
Skip to first unread message

parvez....@decurtis.com

unread,
May 26, 2018, 3:44:00 AM5/26/18
to Couchbase Mobile
For an iOS application backed by Couchbase lite 1.4.1, there are documents that are available to multiple logged in users such that the document's channel contains the userIds of all users that are sharing a document. This document will be synced to all iOS devices where user having an entry in channel logged into the ios application and replicates the document. 

I would like to implement a soft delete option on the document such that when userA opts to delete the document being shared with userB, userC, userD then the UI on userA's device should remove the document but other users continue to have access to that document. This solution should work even when userA logged in from multiple devices and still should not be able to see the document that is deleted but other users should be able to see and edit the document.

Thanks

Jens Alfke

unread,
Jun 11, 2018, 12:54:57 PM6/11/18
to Couchbase Mobile

On May 26, 2018, at 12:44 AM, parvez....@decurtis.com wrote:

I would like to implement a soft delete option on the document such that when userA opts to delete the document being shared with userB, userC, userD then the UI on userA's device should remove the document but other users continue to have access to that document.

Purging a document removes it from a device without affecting any other peers.

This solution should work even when userA logged in from multiple devices and still should not be able to see the document that is deleted but other users should be able to see and edit the document.

That’s not something CBL can do directly. You’d have to implement it yourself, for example by keeping a per-user doc with a list of soft-deleted docIDs for that user, and locally purging every doc listed there.

—Jens

Jens Alfke — Mobile Architect — Couchbase, Inc.

Reply all
Reply to author
Forward
0 new messages