I am using the latest Couchbase Server with Sync Gateway. On the client application swift I push a document like this:
let userChannel = "\(self.login)" config.channels = [userChannel, "zzzz", "nurse1"] config.replicatorType = .pushAndPull _pushPullRepl = Replicator.init(config: config) _pushPullRepl?.start() On the server, I receive this document but the problem is that
"channels": [ null ] So when I try to pull document by channel I receive 0 document.
I have a configuration file here:
{ "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"] } } } } }
Thank's for your responses.
Edit:
Sync function is
"sync": `function(doc) {channel(doc.channels);}` } and i'm getting error
2019-02-25 18:07:14.234729+0100 CouchbaseLiteTest[2474:1149779] CouchbaseLite Sync ERROR: {Push#1} Got error response to rev -YFzAmAK0VWolQcrIv2DiWH 1-a82becb9eacf1c02d0514aeb7f97cfcef9816bda (seq #4): HTTP 500 'Exception in JS sync function'
i don't have error anymore but channel still null on server :(