Can I create a document on the server and replicate it to CB Lite?


#1

I am trying to replicate documents to CB Lite with a pull replication on Android.
I am creating documents on the server with the NodeJS Couchbase SDK. When I create a document I am including a channels property. Looks like this:
{

“channels”: [ “pulluserchannel” ]
}

My sync gateway user looks like this (from curl -k https://127.0.0.1:4985/btleperftest/_user/pulluser ):
{
“name”:“pulluser”,
“admin_channels”:[“pulluserchannel”],
“all_channels”:["!",“pulluserchannel”]
}

It never replicates a single document.

Should this work ?
Or do I have to create the document though the sync gateway instead of creating it on the server directly ?


#2

I think you should create the document though the sync gateway,and do not creating it on the server directly.because after create the document though the sync gateway, sync gateway will do some compute and add _sync property into document for data route and acl.


#3

You can’t create or edit docs directly through Couchbase Server, only through Sunc Gateway.

We’ve tried to make this really clear in the docs, but if you think we should add a note about it somewhere else, please let us know.


#4

Thank you, Jens.

I’d suggest somewhere on this page http://developer.couchbase.com/documentation/mobile/1.3/get-started/sync-gateway-overview/index.html, it should say something like this:

Server-side generated documents are out-of-reach for mobile clients. Documents that are intended for replication from server to mobile clients, must be created either in Couchbase Lite on the mobile client, or through the Sync Gateway REST interface http://developer.couchbase.com/documentation/mobile/1.3/develop/guides/couchbase-lite/index.html.

Thanks for the quick assistance.
Rainer.


#5

Attn. @jamiltz