Skip to content

Commit ffdb091

Browse files
authored
Merge branch 'master' into vkarpov15/gh-14130
2 parents f0f7e75 + cc46cfb commit ffdb091

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

test/types/models.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,3 +862,18 @@ async function gh14114() {
862862
await Test.findOneAndDelete({ name: 'foo' })
863863
);
864864
}
865+
866+
async function gh13999() {
867+
class RepositoryBase<T> {
868+
protected model: mongoose.Model<T>;
869+
870+
constructor(schemaModel: mongoose.Model<T>) {
871+
this.model = schemaModel;
872+
}
873+
874+
async insertMany(elems: T[]): Promise<T[]> {
875+
elems = await this.model.insertMany(elems, { session: null });
876+
return elems;
877+
}
878+
}
879+
}

types/models.d.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,10 @@ declare module 'mongoose' {
395395
docs: Array<TRawDocType>,
396396
options: InsertManyOptions & { rawResult: true; }
397397
): Promise<mongodb.InsertManyResult<Require_id<THydratedDocumentType>>>;
398+
insertMany(
399+
doc: Array<TRawDocType>,
400+
options: InsertManyOptions
401+
): Promise<Array<THydratedDocumentType>>;
398402
insertMany<DocContents = TRawDocType>(
399403
docs: Array<DocContents | TRawDocType>,
400404
options: InsertManyOptions & { lean: true; }

0 commit comments

Comments
 (0)