Change channels of document, but the document still sync to the app that configured with old channels

I have changed the channels of document from “Old” to “New”,
But the app have configured “Old” channels still sync this document.

Any idea to stop syncing the document to “Old” channels?

What is your replicator configuration on your client side ? Have you specified the channels to filter on in your app appropriately ?

Hi Priya,
Yes, I have.
CBL on iOS app I have set pull.channels = [“Old”]
And the app still sync the document that have changed channels from “Old” to "New"
Is this technical of Couchbase system?


I think it might be an access issue.

Watch this video about how sync works with Sync Gateway.

1 Like

OK. So I take it that the CBL app does not want to docs in channel “new”.
When you say “document still sync”, have you checked to see if the “_removed” flag of the synched revision is true ? That will indicate that the document was removed from this channel.

You may want to review this section on channels

Hi Priya,
Thank you for your reply.

I haven’t seen the ‘_removed’ flag.
How to add this flag?

Once. My purpose is don’t allow some older documents sync to app when User re-install the app on the device. so I have changed channels of document from server side.

  1. Replicator channels: ‘Old’,
  2. Document A channels: ‘Old’ (before change)
  3. Document A channels: ‘New’ (after changed)
    It mean i don’t want to sync Document A to the app when user re-install the app after changing channels.

What version of CBL are you using?

No- you don’t generate that. It’s system generated to indicate that there is a change in access rights for this document . The document itself is not deleted from the server/client but by removing the document from the specific channel, you have effectively changed the access rights on the document. The “removed” doc should be there in the changes feed from SGW.

By default, the active-one field is false, which means these “removed” documents will also show up in the feed.
Try querying the SGW directly using the _changes API using Postman or some HTTP client and see what you get back.

In your case, the app may have been reinstalled but it is still listening for changes on the channel when it comes back online again . If you want to just remove “_removed” docs from local store, you can use purge call to locally remove the document. This won’t affect the document on the server as purges don’t sync .

Thanks Priya. I have also did this.

But I want to when the new user install, the app is not sync those documents(changed channels) to down the synchronizing time.
After a year the number of document was created over 17000 document. So I want to sync gateway ignore it when sync to the app (it can show up on the server.)

I don’t see the method on CBL that can set ‘active-one’ or ‘active_only’ for pull replicator.

OK.I take it that you are on CBL 1.4

Yeah, you can’t configure this via the CBL native API. However, if you are starting with an empty database, the first time replication is run, it will pull changes with active_only is true so the deleted and removed documents will not be pulled.
Isn’t that what you are observing ?