After updating a document by DocumentUpdater interface (i put new property and return true in update() callback) when i’m querying that document, revision Id is same and I get old content of that document. however if I restart app, revision id is different (updated) for that document and I get updated content. this must be something minor that i’m missing. can anyone help?
Can you show a bit of code to illustrate what you’re doing?
if (database != null) {
Query query = database.getView(VIEW_TIMESTAMP).createQuery();
query.setAllDocsMode(Query.AllDocsMode.ALL_DOCS);
List<Object> list = new ArrayList<>();
list.add(id);
query.setKeys(list);
QueryEnumerator result;
try {
result = query.run();
for (int i = 0; i < result.getCount(); i++) {
QueryRow row = result.getRow(i);
Document doc = row.getDocument();
doc.update(new Document.DocumentUpdater() {
@Override
public boolean update(UnsavedRevision newRevision) {
Map<String, Object> properties = newRevision.getUserProperties();
properties.put(key, value);
newRevision.setUserProperties(properties);
return true;
}
});
}
} catch (CouchbaseLiteException e) {
e.printStackTrace();
}
}
after this if check revisionId of this docs. they are unchanged, same as it were before update. till I reload the app. after reloading, revision Id is updated and i get updated content.