Question: is it possible to read properties of deleted documents

Hi there,

Is there a way to read properties of a deleted document? I can get the deleted document, yet doc.getUserProperties() and doc.getProperties() are both null in this case.

My use case is: I have maintained a relational structure of documents, let’s say Parent doc and Child doc, using parent_id (foreigh key ) on the child doc. Once a child doc is deleted remotely, I need to know which parent doc it belongs to.

Thanks,
Cheng

Using deleteDocument will remove the properties. Instead,you can set the isDeletion property on CBLSavedRevision to true which will set the _deleted flag to true but the properties will be retained.

But at some point, when you are done with the document, you would want to get rid of the properties of the deleted document to save space.

You can also delete a document by setting its properties to any dictionary that includes the property "_deleted":true. (That’s how a deletion is represented in the database.)