【发布时间】:2019-02-25 17:13:43
【问题描述】:
我正在使用带有同步网关的最新 Couchbase 服务器。在客户端应用程序 swift 我推送这样的文档:
let userChannel = "\(self.login)"
config.channels = [userChannel, "zzzz", "nurse1"]
config.replicatorType = .pushAndPull
_pushPullRepl = Replicator.init(config: config)
_pushPullRepl?.start()
在服务器上,我收到了这个文件,但问题是
"channels": [
null
]
因此,当我尝试按频道提取文档时,我收到 0 个文档。
我这里有一个配置文件:
{
"log": ["*"],
"adminInterface": ":4985",
"databases": {
"dev": {
"num_index_replicas": 0,
"server":"http://localhost:8091",
"bucket": "dev",
"username": "admin",
"password": "adminadmin",
"users": {
"admin": { "disabled": false, "password": "adminadmin"},
"nurse2": { "disabled": false, "password": "adminadmin", "admin_channels": ["nurse2", "_nurse2","nurse1", "_nurse1"]},
"nurse1": { "disabled": false, "password": "adminadmin", "admin_channels": ["nurse1", "_nurse1", "nurse2", "_nurse2"] }
}
}
}
}
感谢您的回复。
编辑:
同步功能是
"sync":
`function(doc) {channel(doc.channels);}`
}
我遇到了错误
2019-02-25 18:07:14.234729+0100 CouchbaseLiteTest[2474:1149779] CouchbaseLite 同步错误:{Push#1} 得到对 rev 的错误响应 -YFzAmAK0VWolQcrIv2DiWH 1-a82becb9eacf1c02d0514aeb7f97cfcef9816bda(seq #4):HTTP 500 'JS 同步功能中的异常'
我不再有错误但服务器上的频道仍然为空:(
【问题讨论】:
-
同步功能在哪里?没有一个,您将永远不会将任何文件放入频道
-
啊,我肯定想念什么
-
我只是添加“同步”:“功能(文档){频道(文档频道);”而且我收到错误 2019-02-25 18:07:14.234729+0100 CouchbaseLiteTest[2474:1149779] CouchbaseLite Sync ERROR: {Push#1} Got error response to rev -YFzAmAK0VWolQcrIv2DiWH 1-a82becb9eacf1c02d0514aeb7f97bce: HTTP: 500 'JS 同步功能异常'
标签: swift xcode couchbase couchbase-lite couchbase-sync-gateway