incubator-couchdb-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Foshay <>
Subject Re: Scaling with filtered replication
Date Wed, 10 Jul 2013 16:25:08 GMT
Benoit Chesneau <bchesneau@...> writes:

> The js evaluation against a lot of documents or with many requests can be
> really slow. espcially when you start a replication on a large database.
> This initial replication can take a long time. This is why the view 
> has been added in rcouch.

Hi Benoit,

Thanks for the recommendation! If I understand the view changes in rcouch 
correctly, we'd need to build a view that returns all docs based on a 
client/user Id, with a filter by timestamp. Something like the following

   "_id": "_design/test", 
   "views": { 
       "by_user": { 
           "map": "function(doc) { if(doc.userId) emit(doc.userId, null); 
           "options": { 
               "seq_indexed": true 
   "options": { 
       "seq_indexed": true, 
       "include_deleted": false

 "filter": {
     "timestampFilter": "function(doc, req) { if(doc.timestamp > 
req.query.timestamp) {return true;} return false; }"


And then we'd use a replication document like

   "source": "testdb", 
   "target": "testdb1", 
   "filter": "_view", 
   "query_params": { 
       "view": "test/by_user/timestampFilter", 
       "key": "user3000",
       "timestamp": "20130701", 

Does that sound about right?


View raw message