Skip to content

Commit

Permalink
[chris-l#31] "keys" query should match more than 1 row for each key
Browse files Browse the repository at this point in the history
  • Loading branch information
Justas Azna committed Jun 29, 2015
1 parent 8793eef commit 98a8b41
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/query_options.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,12 @@ module.exports = function (req, res, rows) {
// This petition requires to filter using 'keys'
if (keys) {
rows = keys.map(function (key) {
return R.find((function (key) {
return function (row) { return isEqual(row.key, key) || undefined; };
}(key)), rows);
return R.filter(function (row) {
return isEqual(row.key, key);
}, rows);
});
rows = rows.filter(function (row) { return row !== undefined; });

rows = rows.reduce(R.union, []);
}

if (startkey && !endkey) {
Expand Down

0 comments on commit 98a8b41

Please sign in to comment.