Android CBL 1.4 getDocument not getting latest revision


#1

I’m debugging an issue in an Android app running CBL 1.4 where, while the app is running, a document is updated with

        Document doc = this.db.getDocument(documentId);
        String docJson = new Gson().toJson(doc.getProperties());

and later retrieved with

            Document doc = db.getExistingDocument(docId);
                if (doc != null) {
                    properties = doc.getCurrentRevision().getProperties();
                } 

, but with the old revision id. If the app is restarted the updated document+revision ID can be seen, but not before.

Similar logic in an iOS app does not show this behaviour.

Anything that might be going wrong here? Do I need to explicitly save the revision ID and pass that to getDocument?


#2

Looks like you missed including the full snippet. How is the putProperties being done. Also, my memory w/ 1.4 is a bit rusty, but I think you do have to specify the revisionId in the _rev when updating an existing document.
Something like this -

if let revId = doc.currentRevisionID  {
             
                userProps["_rev"] = revId
            }