CB Lite: how do you extract delta changes?


I am currently using CB Lite 2.1.1. I looked through many posts regarding how to extract delta changes when listeners get called but I could not find any. I have following questions regarding this topic:

  1. Is there a way to receive or extract only the delta changes using any of the change listeners (database change, liver query, etc.) or find out which keys’ values have changed?
  2. If not, is there a way to query meta data and somehow reconstruct the data for past revisions in order to find the diff with the current version?

Any help is much appreciated.

1 Like

No, there is no API to show you which properties changed.

In 1.x you could load the previous revision and do the property comparison yourself, but in 2.0 it was decided that access to past revisions wasn’t important enough to put in the public API. :frowning:

@priya.rajagopal — revision history, or at least the parent revision, would be useful to re-add to the API.

Thank you @jens for your quick response.

I am actually surprised to hear that Couchbase developers thought that access to the past revisions wasn’t important enough. I thought such a feature would be in big demand by the user community. But I guess the users find that it isn’t difficult to implement the functionality themselves.

I think it would nice if I can pass an option to the live query change listener so that it returns only the keys whose values changed along with their new values in a document.

1 Like

The revision-tree aspect of the data model,can be confusing, as were the Revision vs Document classes in 1.x. In the 2.0 API redesign there was a strong push to simplify, based on our experiences supporting customers. There are areas where it’s become clear we went too far, and we’ll restore functionality that was lost. Input like yours is valuable in helping us.

Thank you for your explanation @jens.