redgeoff opened a new issue #831: Filter _changes by key to speed up replication URL: https://github.com/apache/couchdb/issues/831 ## Expected Behavior From what I understand, using a view for filtered replication is a lot faster than a filter function as after a view is built it can be reused. I believe that filter functions on the other hand need to be executed each time there is a replication and are not "cached." So, I've found that as a general rule, you should try to use a view whenever you need to filter replication. The issue is that in order for me to swap out some of my filter functions with views for filtered replication then I'd need to be able to query the _changes endpoint using a key parameter. Is there a reason that a key parameter cannot be added to the _changes API. (Of course, if this is added then the key parameter could also be added to the PouchDB Replication API. This enhancement would lead to significant speed increases in CouchDB/PouchDB initial replication for many data sets) ## Current Behavior The [_view API](http://docs.couchdb.org/en/2.1.0/api/ddoc/views.html) has a `key` parameter and it functions great when you want to get a list of all the latest docs. No such `key` parameter exists for the _changes endpoint. ## Steps to Reproduce The following is a simple example that illustrates the need. Assume a database named `people` with the design doc ```js { _id: '_design/views', views: { students_by_class: { map: [ 'function(doc) {', 'if (doc.type === "student") {', 'emit(doc.class, null);', '}', '}' ].join(' ') } } } ``` And assume the following docs: ```js { type: 'teacher', name: 'Teacher 1' }, { type: 'student', name: 'Student 1', class: 'Calculus' }, { type: 'student', name: 'Student 2', class: 'Algebra' }, { type: 'student', name: 'Student 3', class: 'Calculus' } ``` Currently, I can only query for all students and not for those in a specific class:`people/_changes?filter=_view&view=views/students_by_class`. Instead it would be great to be able to issue `people/_changes?filter=_view&view=views/students_by_class&key=Calculus` because then I could use a view instead of a filter function in my replication. ## Context Not having the key parameter makes replication a lot slower ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected]
With regards, Apache Git Services
