From 6d0b94e3ff51446875dd3ae6664e140566fa7b84 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sun, 15 Oct 2017 02:12:05 +0300 Subject: [PATCH] [www] lib store changed: added total --- src/lib/store.js | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/lib/store.js b/src/lib/store.js index 5fd464e6..1b06b64e 100644 --- a/src/lib/store.js +++ b/src/lib/store.js @@ -12,5 +12,12 @@ async function findOne(collection, query) { return collection.findOne(query) } +async function total(collection, query) { + return collection + .find(query) + .count() +} + exports.find = find exports.findOne = findOne +exports.total = total