incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Zachary Zolton <zachary.zol...@gmail.com>
Subject Re: Replication filter ignoring deleted docs or changed values
Date Sat, 09 Jul 2011 22:26:06 GMT
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 <mitja@kleider.name> 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
>
>

Mime
View raw message