Skip to content

Commit

Permalink
add count as handler
Browse files Browse the repository at this point in the history
  • Loading branch information
birm committed Apr 23, 2024
1 parent dbd518a commit efdc88d
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions handlers/dataHandlers.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,16 @@ General.find = function(db, collection) {
};
};

General.count = function(db, collection) {
return function(req, res, next) {
var query = req.query;
mongoDB.count(db, collection, query).then((x) => {
req.data = x;
next();
}).catch((e) => next(e));
};
};

General.findWithRegex = function(db, collection) {
return function(req, res, next) {
var query = req.query;
Expand Down

0 comments on commit efdc88d

Please sign in to comment.