couchdb-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <>
Subject [Couchdb Wiki] Update of "Replication" by StephaneAlnet
Date Mon, 23 Sep 2013 10:19:12 GMT
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:

- 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;

View raw message