You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@couchdb.apache.org by Apache Wiki <wi...@apache.org> on 2013/09/23 12:19:12 UTC

[Couchdb Wiki] Update of "Replication" by StephaneAlnet

Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Couchdb Wiki" for change notification.

The "Replication" page has been changed by StephaneAlnet:
https://wiki.apache.org/couchdb/Replication?action=diff&rev1=57&rev2=58

    }
  }
  }}}
- Note: this naive filter will lead to problems if used as-is with a source database in which documents are deleted -- deletions will not be replicated (the document submitted to the filter will not have a {{{type}}} field anymore, so the filter will return {{{false}}}), and if a new document with the same {{{_id}}} is created later, it will not get replicated. A symptom of this issue is an incrementing {{{missing_revisions_found}}} counter in a replication process.
- Deleted documents have a {{{_deleted}}} field though; a better filter might be:
- {{{
-   function(doc, req) {a
-   if(doc._deleted) {
-     return true;
-   }
-   if (doc.type && doc.type == "foo") {
-     return true;
-   } else {
-     return false;
-   }
- }
- }}}
  
+ Note: When using filtered replication you should not use the DELETE method to remove documents, but instead use PUT and add a {{{_deleted:true}}} field to the document, preserving the fields required for the filter. Your Document Update Handler should make sure these fields are always present. This will ensure that the filter will propagate deletions properly.
  
  Filters live under the top-level "filters" key;