The app creates an empty database and then tries to pull the database from the server. It works with the “grocery-sync” bucket but not with a different database with some documents inside.
void) replicationChanged: (NSNotification*)n is only called a few times and should be called (way) more often. There seem to be no changes in the bucket (pull.changesCount is 0).
Hm, the problem seems to be that the documents are not assigned to a channel (I created the testbucket from a java app directly without sync server)?
And the sync function uses ‘channel(doc.channels)’ for database “test”.
Is this the problem? Then how do I assign (existing) documents of a bucket to a channel? I assume this can be done in a view? Or can I assign a channel (property) then the documents are introduced into couchbase (via Java Couchbase Client 2.02 API)?
I created the testbucket from a java app directly without sync server
Don’t do that! The gateway’s bucket is private and should only be modified by Sync Gateway itself. If you want to write to it from your own code, either talk to the gateway’s REST API, or use the bucket shadowing feature to create a separate bucket that you can use Couchbase SDKs to write to.
“The body of the request contains the database configuration as a JSON object ()the same as an entry in the databases property of a configuration file. Note that this doesn’t create a Couchbase Server bucket—you need to do that before configuring the database.”
So, first I need to create the bucket in the couchbase, then configure it via the sync gateway? Can you/someone tell me how?
Create the bucket in the Couchbase Server web admin UI; it’s easy.
You’ll probably want to add the database to Sync Gateway by editing its config file. If you do it using a PUT request, the setting isn’t persistent and will need to be redone next time you start the gateway.
I created the bucket manually. Then I start the sync gateway pointing to the bucket. I thought it is required to configure something more to be able to sync.
Don’t use new_edits=false. That mode is pretty much only used by the replicator; it requires that the document be an existing revision complete with some extra metadata such as a revision history.
Thanks (for the help!), I was able to create the bucket. I am not a web developer … maybe this would have helped … it’s often the little things in webdev.
Yeah, we don’t have much tutorial documentation of the REST API. That’s partly because it’s nearly identical to the CouchDB REST API, which is already documented pretty well elsewhere. (That isn’t an excuse, and we do plan to add more docs, but at least for this particular doc hole we can point people to external sites like the CouchDB docs and the CouchDB book.)