Comparing version 2.0.0 to 2.1.0
@@ -38,2 +38,4 @@ import * as mongodb from 'mongodb' | ||
deleteMany (filter: mongodb.FilterQuery<TSchema>, options?: mongodb.CommonOptions): Promise<number> | ||
aggregate<T = TSchema> (pipeline: object[], options?: mongodb.CollectionAggregationOptions): Promise<T[]> | ||
} | ||
@@ -40,0 +42,0 @@ |
@@ -181,4 +181,18 @@ const debug = require('debug') | ||
} | ||
async aggregate (pipeline, opts) { | ||
const db = await this.parent.db() | ||
try { | ||
this[kDebug]('aggregate(%o)', pipeline) | ||
const res = await db.collection(this.name).aggregate(pipeline, opts).toArray() | ||
this[kDebug]('reply OK') | ||
return res | ||
} catch (err) { | ||
this[kDebug]('reply ERR') | ||
throw err | ||
} | ||
} | ||
} | ||
module.exports = Collection |
{ | ||
"name": "albatross", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"license": "MIT", | ||
@@ -5,0 +5,0 @@ "author": "Linus Unnebäck <linus@folkdatorn.se>", |
@@ -162,2 +162,6 @@ # ![Albatross](/header.png?raw=true "Albatross") | ||
#### `aggregate(pipeline[, opts]): Promise<object[]>` | ||
Executes an aggregation framework pipeline against the collection. Resolves with the aggregated objects. | ||
### Grid | ||
@@ -164,0 +168,0 @@ |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
21543
380
227
0