Hello,
We are running tests on limiting the data being synced to the mobile and are facing an issue with documents being synced even after the channel has been removed from the document.
CBLite version: 2.8
SyncGateway Version: 2.0.0
Sync Function for setting the channel:
if (doc.removeChannel) {
channel('sync_remove');
} else {
channel(['sync1', 'sync23']);
}
The created document looks like this,
[
{
"certrax": {
"_sync": {
"cas": "",
"channels": {
"sync1": null,
"sync23": null
},
"history": {
"channels": [
[
"sync1",
"sync23"
]
],
"parents": [
-1
],
"revs": [
"1-f9fc4a537c66fa41a899ef758a021118"
]
},
"recent_sequences": [
406419
],
"rev": "1-f9fc4a537c66fa41a899ef758a021118",
"sequence": 406419,
"time_saved": "2022-06-10T08:53:36.728361525Z"
},
"date": "2022-06-10",
"type": "_fh_dummy_data_channel_doc"
}
}
]
And then update the document to remove from the syncing channel. Now the document sync data looks like below
{
"certrax": {
"_sync": {
"cas": "",
"channels": {
"sync1": {
"rev": "2-1c82d431ceaa1b95f0cfb083f3e71597",
"seq": 406420
},
"sync23": {
"rev": "2-1c82d431ceaa1b95f0cfb083f3e71597",
"seq": 406420
},
"sync_remove": null
},
"history": {
"channels": [
[
"sync1",
"sync23"
],
[
"sync_remove"
]
],
"parents": [
-1,
0
],
"revs": [
"1-f9fc4a537c66fa41a899ef758a021118",
"2-1c82d431ceaa1b95f0cfb083f3e71597"
]
},
"recent_sequences": [
406419,
406420
],
"rev": "2-1c82d431ceaa1b95f0cfb083f3e71597",
"sequence": 406420,
"time_saved": "2022-06-10T08:55:54.584117658Z"
},
"date": "2022-06-10",
"removeChannel": true,
"type": "_fh_dummy_data_channel_doc"
}
}
]
When we start the “fresh” replication by uninstalling and re-installing the application and trying to replicate the “sync1” channel, the above document is being synced.
We are assuming that if a channel is removed from the document or replaced with a new channel name, then the initial sync should not replicate that document.