I’m trying to sync a Couchbase bucket from the server to an iOS app using the Couchbase Sync Gateway and Couchbase Lite for iOS.

So far I’m working with the "beer-sample" example bucket that comes with Couchbase.

On my Ubuntu 12.04 LTS VM, the Couchbase Sync Gateway is started with this config file:

{
   "interface":":4984",
   "adminInterface":":4985",
   "log":["REST"],
   "databases":{
      "sync_gateway":{
         "server":"http://localhost:8091",
         "bucket":"beer-sample",
         "sync":`function(doc) {channel(["public"]);}`,
         "users": {
             "GUEST": {"disabled": false, "admin_channels": ["public"]}
          }
      }
   }
}

My intention is to get it running without worrying about authentication first, therefore the GUEST user.

I’ve also modified some example to make sure the channel assignment is not dependent on the documents, because the sample bucket doesn’t have any channel assignment:

"sync":`function(doc) {channel(["public"]);}`,

I included some code from https://github.com/couchbaselabs/ToDoLite-iOS/blob/master/TodoLite7/CBLSyncManager.m into my own example project, and after a bit of trying the iOS can actually connect to the connector.

The NSLog in line 168 gives me this output:

[1026:60b] SYNCMGR: active=0; status=1; 0/0; (null)
[1026:60b] SYNCMGR: active=1; status=3; 0/0; (null)
[1026:60b] SYNCMGR: active=0; status=2; 0/0; (null)

…and my interpretation of that is that the syncing (of 0 documents) was working successfully.

Why does the Couchbase Sync Gateway not report any documents to Couchbase Lite? I’m obviously missing something. I suspect the channels are not setup correctly.

Any help will be appreciated and if your answer solves my problem, I will accept it.

有帮助吗?

解决方案

as this was re-posted from our communities portal, I will close out this issue here with a re-post in response and continued questions should be on our communities portal.

Based on your description of the issue and configuration, you still need to configure your Sync Gateway to let it know there is an existing Couchbase Server bucket it needs to sync from.

This is a recent feature add after our Beta 2; we're currently working on the documentation, which is available interim here: https://github.com/couchbase/sync_gateway/wiki/Bucket-Shadowing

Continued thread can be found here: http://www.couchbase.com/communities/q-and-a/sync-couchbase-lite-through-couchbase-sync-gateway-doesn%E2%80%99t-see-any-documents-channel-issue

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top