Sync gateway how to modify _changes feed, so to exclude "removed":["channel"] messages

I have a sync function that includes the following code:


function isExplicitlyNotAllowedToBeSynced() {
return (doc.AllowSync === false);

I include this in order to be able to exclude some of my docs from sync procedure by means of including field (flag): “AllowSync = false”. By default all of my docs have this field set to “true”.

But I am facing the following problem, when I set AllowSync to “false” all of my clients receive alot of the following rows in _changes feed:



So if i have alot of documents that belong to channel “resourcesChannel” I got alot of sync work.
Especially it is crucial for new users who have access to this channel and out of the box they have to download those _change feed rows even if they dont have any of those documents before.

Please tell me how to exclude those messages from changes feed for a new users

An initial replication for new users (using Couchbase Lite) is usually run with active_only=true, which will omit removals and tombstones.

Having said that, there’s something a bit unusual about the _changes response you show above. I normally wouldn’t expect a removal for rev 1 of a document - the removed property indicates that a previous revision of the document was in the channel, but the current revision is not. Assuming that’s not just a mocked up response, it suggests that there’s something unexpected going on (possibly unresolved conflicts for that document)?