Merge pull request #26527 from YouriT/patch-1

Mongoose: expose Aggregate.count(..) method
This commit is contained in:
Nathan Shively-Sanders
2018-06-19 11:09:26 -07:00
committed by GitHub
2 changed files with 7 additions and 0 deletions

View File

@@ -2276,6 +2276,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

View File

@@ -1200,6 +1200,7 @@ aggregate.allowDiskUse(true).allowDiskUse(false, []);
aggregate.append({ $project: { field: 1 }}, { $limit: 2 });
aggregate.append([{ $match: { daw: 'Logic Audio X' }} ]);
aggregate.collation({ locale: 'en_US', strength: 1 });
aggregate.count('countName');
aggregate.cursor({ batchSize: 1000 }).exec().each(cb);
aggregate.exec().then(cb).catch(cb);
aggregate.option({foo: 'bar'}).exec();