Skip to content

Commit

Permalink
(#285) - Support lists with views from other DDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
mroeder authored and marten-de-vries committed Feb 5, 2016
1 parent feec202 commit 96a0422
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
10 changes: 9 additions & 1 deletion lib/routes/list.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,19 @@ module.exports = function (app) {

// Query design document list handler
function handler(req, res, next) {
var query = [req.params.id, req.params.func, req.params.view].join("/");
var queryParts = [req.params.id, req.params.func];
if ('id2' in req.params) {
queryParts.push(req.params.id2);
}
queryParts.push(req.params.view);
var query = queryParts.join("/");
var cb = utils.sendCouchDBResp.bind(null, res);
req.db.list(query, req.couchDBReq, cb);
}
app.all('/:db/_design/:id/_list/:func/:view',
utils.couchDBReqMiddleware, handler
);
app.all('/:db/_design/:id/_list/:func/:id2/:view',
utils.couchDBReqMiddleware, handler
);
};
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"pouchdb-all-dbs": "^1.0.0",
"pouchdb-auth": "^1.0.2",
"pouchdb-find": "^0.1.0",
"pouchdb-list": "^1.0.0",
"pouchdb-list": "^1.1.0",
"pouchdb-replicator": "^2.1.0",
"pouchdb-rewrite": "^1.0.0",
"pouchdb-security": "^1.2.0",
Expand Down

0 comments on commit 96a0422

Please sign in to comment.