couchdb-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "viorel mitache (JIRA)" <j...@apache.org>
Subject [jira] Updated: (COUCHDB-64) Enable selective replication
Date Fri, 08 Jan 2010 13:50:55 GMT

     [ https://issues.apache.org/jira/browse/COUCHDB-64?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

viorel mitache updated COUCHDB-64:
----------------------------------

    Attachment: replication_filter.patch

 Filtered replication, using already in place _changes filter.
 Added two extra options for _replicate handler
 {
    source:..
    target:..
    "filter": "designDoc/filterFn",
    "filter_params" : "p1=v1&p2=v2.." // optional query params - will be passed to _changes
handler
  }

design doc example

{
   "_id": "_design/d1",
   "_rev": "19-d2e5f7715acdbe68938925fe2a22d192",
   "language": "javascript",
   "filters": {
       "none": "function(doc, req) { return false; }",
       "design_docs": "function(doc, req) { return doc._id.match('_design/(.*)')}",
       "by_location": "function(doc, req) { var location_tags = req.query.location_tags; \n
if(!location_tags) {return false;} \n if(!doc.location_tags) {return true;} \n location_tags
= location_tags.split(','); \n for(var x=0; x < location_tags.length;x++) { \n for(var
y = 0;y < doc.location_tags.length;y++) { \n if(location_tags[x] == doc.location_tags[y])
{return true;} \n } \n } \n return false;}"
   }
}

test command line(s) :

 curl -X POST -d "{\"source\":<src_db>,\"target\":<target_db>.\"filter\":\"d1/design_docs\"}"
http://host:port/dbname/_replicate

OR

 curl -X POST -d "{\"source\":<src_db>,\"target\":<target_db>.\"filter\":\"d1/by_location\",\"filter_params\":\"location_tag=loc1\"}"
http://host:port/dbname/_replicate




> Enable selective replication
> ----------------------------
>
>                 Key: COUCHDB-64
>                 URL: https://issues.apache.org/jira/browse/COUCHDB-64
>             Project: CouchDB
>          Issue Type: Improvement
>          Components: Replication
>         Environment: All
>            Reporter: Jan Lehnardt
>            Priority: Minor
>             Fix For: 0.11
>
>         Attachments: replication_filter.patch
>
>
> Make it possible to filter the set of documents that is to be replicated. Also allow
replication to omit attachment-data.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message