npm.io
1.0.1 • Published 9 years ago

mongo-count-by

Licence
MIT
Version
1.0.1
Deps
1
Vulns
1
Weekly
0

MongoDB Count By

Like _.countBy from lodash, but over MongoDB collection

Install

$ yarn add mongo-count-by

Usage

import {init, countBy} from 'mongo-count-by';

await init('mongodb://localhost:27017');

const counts = await countBy('type'); // {a: 1, b: 2, c: 3}