Expose Aggregate.count(countName) method

The Aggregate class should expose a `count(countName)` method that adds a `$count` aggregator in the pipeline.

Documented here: http://mongoosejs.com/docs/api.html#aggregate_Aggregate-count
Code @5.0.15 referencing this method: https://github.com/Automattic/mongoose/blob/5.0.15/lib/aggregate.js#L379
This commit is contained in:
Youri Tolstoy
2018-06-13 23:12:49 +02:00
committed by GitHub
parent ac8c4cb9c0
commit 4fa4ba6bd1

View File

@@ -2274,6 +2274,12 @@ declare module "mongoose" {
/** Adds a collation. */
collation(options: CollationOptions): this;
/**
* Appends a new $count operator to this aggregate pipeline.
* @param countName name of the count field
*/
count(countName: string): this;
/**
* Sets the cursor option option for the aggregation query (ignored for < 2.6.0).
* Note the different syntax below: .exec() returns a cursor object, and no callback