I added a workaround for non-sync users and a workaround for sync users.
Non-sync users
- Delete file via Android Studio
- App code recognizes that the file is missing and deletes the pointer to the file in the document
- Document can be parsed now. Attachment is lost. All good!
Sync users
- Delete file via Android Studio
- App code recognizes that the file is missing and sends a web request to update the file via Couchbase Java SDK. The update adds (or updates) a newly added field.
- Document is downloaded, can be parsed. Attachment is available on disk. All good!
The following did not work for sync users:
- Delete file via Android Studio for 1st time of document A
- App code recognizes that the file is missing, purges the document, one-shot pull replicator with document ID is started to pull down the document
- Document is downloaded, can be parsed. Attachment is available on disk. All good!
- Delete the same file via Android Studio for 2nd time of document A
- App code recognizes that the file is missing, purges the document, one-shot pull replicator with document ID is started to pull down the document
- Document is never downloaded. The whole document is lost forever.
I found this behaviour interesting and wanted to share it.
I did however use the replicator strategy here as I know that this document needs to be there. If I see that this issue happens more than once per user I can update the app code with the first strategy.