Question

I am using Couchbase lite 1.0 beta2 to get and replicate data from couchbase server. In My case, If a document is deleted from server, I am unable to check it in android app whether a document already present locally is deleted from server. In the replicator method, it only returns me the changed documents or newly added documents.

I tried with "document.isDeleted()" but it always returns false.

So, How can I put a check whether a document is deleted from server?

Was it helpful?

Solution

A deleted document uses the special property _deleted: true to indicate a tombstoned document. So it's possible to build a view to index these documents. It's important that you are specifically using this property and not simply deleting the document.

Here is what the couchbase documentation says on tombstoning:

Tombstoning

The reason that tombstone revisions exist is so that deletes can be sync'd to other databases. If revisions were simply deleted with a naive approach, then there would be no easy way to sync up with other databases that contained the revision.

Couchbase Lite docs

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top