From 4fa4ba6bd1bb1a29ffa36c65ec0e65573d5af76f Mon Sep 17 00:00:00 2001 From: Youri Tolstoy Date: Wed, 13 Jun 2018 23:12:49 +0200 Subject: [PATCH] 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 --- types/mongoose/index.d.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/types/mongoose/index.d.ts b/types/mongoose/index.d.ts index a94f3a691d..ba0e6344cb 100644 --- a/types/mongoose/index.d.ts +++ b/types/mongoose/index.d.ts @@ -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