We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
mongoosejs
Learn more about funding links in repositories.
Report abuse
2 parents 1ef8274 + 067e3a2 commit 8a52485Copy full SHA for 8a52485
index.d.ts
@@ -578,8 +578,8 @@ declare module "mongoose" {
578
interface Model<T extends Document> extends NodeJS.EventEmitter {
579
new(doc?: any): T;
580
581
- aggregate<R>(pipeline?: any[]): Aggregate<Array<R>>;
582
- aggregate<R>(pipeline: any[], cb: Function): Promise<Array<R>>;
+ aggregate<R = any>(pipeline?: any[]): Aggregate<Array<R>>;
+ aggregate<R = any>(pipeline: any[], cb: Function): Promise<Array<R>>;
583
584
/** Base Mongoose instance the model uses. */
585
base: typeof mongoose;
test/typescript/models.ts
@@ -21,3 +21,5 @@ const ExpiresSchema = new Schema({
21
expires: 3600,
22
},
23
});
24
+
25
+const aggregated: Promise<Document> = Test.aggregate([]).then(res => res[0]);
0 commit comments