How to: XDCR with same buckets but different scopes&collections / filters

We’re replicating buckets across different sites through XDCR.

We had 3 buckets replicating with different filters:

  • 2 buckets had the same “custom” filter expression;
  • 1 bucket had a “do not replicate DELETE operation” filter.

Then we moved the buckets into scopes&collections of a single parent bucket.

The replication from the source bucket to the target bucket can only be specified once.
The XDCR including all the 3 collections would apply the 2 filters to all of them.
The problem now is that the we need to keep different filters for the different scope&collections as described above, but that seems not possible.

As a workaround, we used a replication from the 3rd collection to a local staging bucket which was used to replicate with a filter in the same target bucket.

Is there a possibility to specify the “do not replicate DELETE operation” in a filter expression, in order to avoid the staging bucket and filter the DELETE operation only for the documents with specific values?

Any advice on this topic?

To better explain, we had the following XDCR Topology (only replicating _default scope/collection):
ClusterA.bucket1 → ClusterB.bucket1 - Filter 1
ClusterA.bucket2 → ClusterB.bucket2 - Filter 1
ClusterA.bucket3 → ClusterB.bucket3 - Filter 2

Then we moved “bucket2” and “bucket3” as scopes into the bucket1.
The following XDCR Topology is now present:
ClusterA.bucket1.scope1.collection1 → ClusterB.bucket1.scope1.collection1 - Filter 1
ClusterA.bucket1.scope2.collection2 → ClusterB.bucket1.scope2.collection2 - Filter 1

But I cannot create the following replication, since another filter is needed and I cannot specify same source/target buckets with different collections in another replication rule:
ClusterA.bucket1.scope3.collection3 → ClusterB.bucket1.scope3.collection3 - Filter 2

To avoid that I created a staging bucket and I’m using the local staging bucket as source for the new replication rule:
ClusterA.bucket1.scope3.collection3 → ClusterA.bucket1_staging.scope3.collection3
ClusterA.bucket1_staging.scope3.collection3 → ClusterB.bucket1.scope3.collection3 - Filter 2

So my question is: since Filter 2 is a “do not replicate DELETE operation”, can it be included in some way as a code in the Filter 1 expression?