Could you change your filter to something like this?

function(doc) {
  return doc._deleted || doc.type == 'foo';
}

That way you replicate all deleted docs.

-Zach

On Saturday, July 9, 2011, Mitja Kleider <[email protected]> wrote:
> Hi,
>
> as an example I chose the replication filter function from
> http://wiki.apache.org/couchdb/Replication#Filtered_Replication
>> function(doc, req) {
>>   if (doc.type && doc.type == "foo") {
>>     return true;
>>   } else {
>>     return false;
>>   }
>> }
>
> After replicating to another db, change a document containing type="foo" to 
> type="bar" and replicate again.
> Because the filter function returns false, the document remains unchanged in 
> the replicated db.
> The same happens when deleting the document containing type="foo". The filter 
> function returns false on the deleted document, the deletion is not 
> replicated.
>
> I would like to achieve a different behavior:
> If the filter function returns false, but the document was replicated 
> previously, it should be deleted.
>
> Any ideas how to solve this?
>
>
> Thanks,
> Mitja
>
>

Reply via email to