Android LiveQuery.ChangeEvent getRows() not returning original data


#1

The document below suggests that event.getRows() should return the QueryRows from before the change. When doing a diff between event.getRows() and mylivequery.getRows(), I found that both of them are giving the same latest query results. Am I doing something wrong here?

http://developer.couchbase.com/documentation/mobile/1.1.0/develop/training/build-first-android-app/understanding-live-query/index.html


#2

I’m not familiar with the Android API, but I believe that documentation page is wrong, and that the event contains the new data, not the old.

The page is also misrepresenting the event as being about document changes, when it’s really about view index changes. Or rather, the event triggers because the results of the query change. Depending on what the view’s map function indexes, it’s possible for a document to change without altering the query results. Or a document change could cause multiple query rows to change.

I’ll file a ticket to get the page updated.


#3

Thank you for your reply Jens.
Besides caching the previous QueryEnumerator data, is there any way to get the original data?


#4

No, I don’t think so. Just hold onto the old value if you need to compare them.