daleharvey/pouchdb — pull request #692 by nick-thompson (2013-04-16 16:06:57+00:00)
Title: api.changes filter without `continuous=true`

There's a bunch of tests surrounding the `filter` argument to the changes feature in the CouchDB changes test file that fail against PouchDB because our changes function doesn't apply the filter when continuous=false and onChange is not specified.

Example,
https://github.com/daleharvey/pouchdb/blob/master/src/adapters/pouch.idb.js#L827
https://github.com/daleharvey/pouchdb/blob/master/src/pouch.utils.js#L214

So in the above code, the results are mapped to filterChange, which calls `opts.onChange` with the change only if the change meets the filter criteria. Next, the idb adapter calls `opts.complete` with the entire results array (non-filtered).

The CouchDB test suite expects `opts.complete` to be called with the filtered results array.. but all of our adapters do it the other way

https://github.com/daleharvey/pouchdb/blob/master/src/adapters/pouch.websql.js#L614
https://github.com/daleharvey/pouchdb/blob/master/src/adapters/pouch.leveldb.js#L663

Is this a design decision that differs from CouchDB or a bug? The comment above line 663 in my last link makes me think it's a bug. Map doesn't affect the array in-place.