Server setup (Docker on linux VM)
couchbase:community-5.1.1
couchbase/sync-gateway:2.1.2-community
Sync gateway config:
{
"log": ["*"],
"adminInterface": "0.0.0.0:4985",
"interface": "0.0.0.0:4984",
"databases": {
"mybucket": {
"server": "http://couchbase:8091",
"use_views": true,
"bucket": "XXX",
"username": "myuser",
"password": "mypassword",
"enable_shared_bucket_access": true,
"import_docs": "continuous",
"users": {
"GUEST": { "disabled": true },
"mybucketuser": { "password": "mybucketpassword" }
},
"import_filter": `
function(doc) {
if (doc.type != "CONFIG") {
return false
}
return true
}
`,
"sync": `
function (doc, oldDoc) {
channel(doc.devices);
}
`
}
}
Client (Native Android app)
com.couchbase.lite:couchbase-lite-android:2.1.0
I’ve noticed an unexpected behavior while updating documents directly in Couchbase Server (not via Sync Gateway) and the change causes doc channels modification.
Let’s say I have 2 docs, on different channels
{ "type": "CONFIG",
"devices": ["123"],
...}
channel --> 123
and
{ "type": "CONFIG",
"devices": ["abc"],
...}
channel --> abc
Every device pull syncs filtering on its channel and receives its configuration (Device “X” filters on channel “123”, device “Y” filters “abc”).
After modifying from Couchbase web interface (Buckets --> Documents --> Lookup by ID --> change content and save) the documents situation is the following:
{ "type": "CONFIG",
"devices": ["123XXX"],
...}
channel --> 123XXX
and
{ "type": "CONFIG",
"devices": ["abc","123"],
...}
channels --> 123 and abc
Browsing data form Sync Gateway _admin interface shows that the documents channels has been updated as expected, but the device that pulls data filtering on channel “123” receives 2 documents instead of receiving only the second one as expected. I’ve also tried to delete the first doc from db, but it’s still received from the device. Tried to completely remove app from device, reboot, all Android backups are disabled in device & app manifest, last device backup deleted from Google Drive.
Even after deleting the first document it wasn’t reachable any more from the sync gateway rest interface, but still synced via ws protocol.
So, I decided to reboot sync gateway, delete apps data, restart sync and the device received only the second document as expected.
Is there any knows issue while changing data in the document relying on shared bucket access when changes affects docs channels?