Sync doc from Couchbase Server to mobile device


#1

We are working with the Couchbase lite phonegap plugin, and creating our app with JavaScript and HTML5.
First, as I know by using PhoneGap Couchbase Lite plugin, the local DB was created on mobile device easily. We can now create the doc and retrieve them on the device. I can also sync the docs on device to Couchbase server (we can see the doc on the server now).

However, how can we replicate new docs and updated docs on the server to the device?

Does it must go thought Channels?

Currently we don’t set any Channels. does that means we should be able to replicate to all devices? but it seems not.

Does it needs to make any authentication before or during replication? if yes Any example code with JS?

Currently we are using GUEST, by running below on server. (I know using GUEST may be not the final solution, I just want it works first).

$ curl -X PUT localhost:4985/$DB/_user/GUEST --data '{“disabled”:false, “admin_channels”:[“public”]}'

But the replication still not working.

if it has to make authentication before replication, Is there other way to do the authentication besides using facebook and Mozilla Persona in my situation?

If we want to distribute some docs to the devices with replication feature, what should we do?

Does it has to insert those docs with Sync Gateway commend? Any special settings like, the Channels?

Are there any thing we should aware when distributing these docs, like during setting the Couchbase server and Sync Gateway or creating these doc?

So sorry for so many questions there.
Thanks so much for your time.
Sam


#2

Hi there, are the new docs created outside of using Couchbase Lite/Sync Gateway? There is a known compatibility issue (http://docs.couchbase.com/sync-gateway/#limitations) that we are working on, using a solution called ‘Bucket Shadowing’: https://github.com/couchbase/sync_gateway/wiki/Bucket-Shadowing

It’s unclear if that is necessarily the issue, but to answer a few of your questions: yes, using GUEST and not using channels would mean that a data set stored to Couchbase Server via a Couchbase Lite client will be synced down to all other Couchbase Lite clients.