Couchbase Lite Couchbase Server Sync Question

65 views
Skip to first unread message

Paing Kaung

unread,
Jul 3, 2014, 10:24:07 AM7/3/14
to mobile-c...@googlegroups.com

I created a very simple document in ios app in local database.
I've configured CBL to sync both ways. 


{"testkey" : "value1"}

I can see that the document is being pushed to the Couchbase Server via sync gateway.

Later, I use Java Client to change the value of the same document on the Couchbase Server.

{"testkey": "value2"}

However, I don't see the changes being pulled to my Couchbase lite.

I tried editing the document via  Couchbase Server Admin Interface and it didn't get pulled either. May I know how do I get the it sync to Couchbase lite please?

Thanks,
Paing


Andrew Reslan

unread,
Jul 3, 2014, 11:53:30 AM7/3/14
to mobile-c...@googlegroups.com
Changes to documents at the Couchbase Server level will not be reflected by sync_gateway.

Instead modify documents via the sync_gateway REST API.

This is similar to the Couchbase Lite REST API, documented here

The sync_gateway REST API supports most of the CouchDB REST API for which there is lots of documentation and examples.

Andy

Paing Kaung

unread,
Jul 3, 2014, 12:02:26 PM7/3/14
to mobile-c...@googlegroups.com
Thank you very much Andrew.
So, I cannot use Java Client API, Reactivecouchbase API etc... to sync to couchbase lite? How about Bucket Shadowing? If I update a document in the shadowed bucket via java Client API, would that work?

Paing

Jens Alfke

unread,
Jul 3, 2014, 12:46:48 PM7/3/14
to mobile-c...@googlegroups.com
The bucket used by the Sync Gateway to store a database is private — please don’t make changes to it. There’s extra metadata in the documents that’s necessary to make sync work.

If you need to edit documents on the server, either:
* use the “bucket shadowing” feature to make the gateway use its own shadow copy of a regular bucket that you can make changes to;
* or use the Sync Gateway’s REST API to operate on the documents, instead of the Couchbase Server API. (The Gateway’s REST API is nearly identical to the Couchbase Lite and CouchDB REST APIs.)

—Jens

Jens Alfke

unread,
Jul 3, 2014, 1:20:09 PM7/3/14
to mobile-c...@googlegroups.com

On Jul 3, 2014, at 9:02 AM, Paing Kaung <paing...@gmail.com> wrote:

How about Bucket Shadowing? If I update a document in the shadowed bucket via java Client API, would that work?

Yes; that’s what bucket shadowing was designed for.

—Jens
Reply all
Reply to author
Forward
0 new messages