Skip to content
This repository was archived by the owner on Jan 30, 2023. It is now read-only.

Commit 40b0d7a

Browse files
authored
Allow schema level aggs
1 parent bb36cfc commit 40b0d7a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/index.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
let _ = require('lodash/fp')
12
let Promise = require('bluebird')
23

34
// Basic function to encapsulate everything needed to run a request - tiny wrapper over raw mongo syntax
@@ -18,12 +19,13 @@ let MongoProvider = config => ({
1819
request: {
1920
// criteria: filters,
2021
collection: schema.mongo.collection,
21-
aggs: [
22+
aggs: _.compact([
23+
...schema.mongo.aggs,
2224
{
2325
$match: filters || {},
2426
},
2527
...aggs,
26-
],
28+
]),
2729
},
2830
}
2931

0 commit comments

Comments
 (0)