Requesting changes from a server

41 views
Skip to first unread message

Alan McKean

unread,
Feb 10, 2014, 7:02:55 PM2/10/14
to mobile-c...@googlegroups.com
My current app, using Core Data, tracks the last sequence number and requests changes on each launch. I don't see a changes request in the API for Couchbase Lite. Is there a way to request changes since a sequence number?

Jens Alfke

unread,
Feb 10, 2014, 8:25:23 PM2/10/14
to mobile-c...@googlegroups.com

On Feb 10, 2014, at 4:02 PM, Alan McKean <alanm...@me.com> wrote:

My current app, using Core Data, tracks the last sequence number and requests changes on each launch. I don't see a changes request in the API for Couchbase Lite. Is there a way to request changes since a sequence number?

The native API doesn't have a direct equivalent of the _changes feed from the REST API. 

In the latest revisions on the master branch (but not in beta 2) you can create your own equivalent by defining a view whose key is the sequence number of the document; the map block would look like
emit(doc[@"_local_seq"], nil);
Then you can query the view with the startKey being one more than the last sequence you saw.

This support didn't make it into beta 2 (the "_local_seq" key isn't available in the map function) but will be in the GA release.

—Jens
Reply all
Reply to author
Forward
0 new messages