Skip to content

Commit

Permalink
Merge branch 'master' into vkarpov15/gh-14130
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed Dec 5, 2023
2 parents f0f7e75 + cc46cfb commit ffdb091
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/types/models.test.ts
Expand Up @@ -862,3 +862,18 @@ async function gh14114() {
await Test.findOneAndDelete({ name: 'foo' })
);
}

async function gh13999() {
class RepositoryBase<T> {
protected model: mongoose.Model<T>;

constructor(schemaModel: mongoose.Model<T>) {
this.model = schemaModel;
}

async insertMany(elems: T[]): Promise<T[]> {
elems = await this.model.insertMany(elems, { session: null });
return elems;
}
}
}
4 changes: 4 additions & 0 deletions types/models.d.ts
Expand Up @@ -395,6 +395,10 @@ declare module 'mongoose' {
docs: Array<TRawDocType>,
options: InsertManyOptions & { rawResult: true; }
): Promise<mongodb.InsertManyResult<Require_id<THydratedDocumentType>>>;
insertMany(
doc: Array<TRawDocType>,
options: InsertManyOptions
): Promise<Array<THydratedDocumentType>>;
insertMany<DocContents = TRawDocType>(
docs: Array<DocContents | TRawDocType>,
options: InsertManyOptions & { lean: true; }
Expand Down

0 comments on commit ffdb091

Please sign in to comment.