Couchbase lite Android getting null values (properties)

Hi,

Some times When I try to do document.getProperties will return me empty properties map.

This issue happens randomly, if it happens the only solution is to uninstall and reinstall the app to create new document.

Can any one please tell me at what scenarios document.getProperties() will return empty.

Observations:
When I tried to debug into the android library, I noticed currentRevision = null. If in case currentRevision becomes null document will always return null for all the API calls.
As per the document cuurentRevision becomes null if document is purged, I haven’t implemented any thing which will delete or purge a document.

Regards,
Srikar

What version of Couchbase Lite are you using ?

In Couchbase Lite, the Compaction process happens automatically in the background but it only rids the JSON bodies of non leaf revisions.
Additionally, there is expirationDate (Couchbase Capella for Mobile Developers) associated with document. If a document expires, then the doc is purged.

You may want to check the expirationDate of the document.
And is it possible that the document is getting purged at the Sync Gateway/ server side or by some other client.

If the document doesn’t exist in the database, the Document object you get will be empty. Is it possible you’re using the wrong ID when getting the document from the database?