Deleting Documents

Im currently reviewing the couchbase document guide

While reading the deleting documents section i noticed the following:

Deleting a document actually just creates a new revision (informally called a “tombstone”) that has the special _deleted property set to true. This ensures that the deletion will replicate to the server, and then to other clients that pull from that database, just like any other document revision.

Taking this into consideration i have a scenario based on a mobile chat app that needs clarification. If 2 users of the chat app send messages to each other and then delete a few of their messages what happens when a 3rd user gets the app? will all messages including the ones marked as deleted sync to the new users device or will only the documents that do not have the _deleted property set to true be synced ?


Replication copies the latest/current revisions of all documents. So in the case of deleted documents the tombstone revisions get synced. However, these are tiny, nothing more than docID, revID and deleted:true. The replicator gives these lower priority, so on the initial replication the live docs get pulled first, then the tombstones.

Hi @jens

Thanks for the clarification.