-
-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
insertMany return type incompatible with document type #13999
Comments
Just remove the import * as mongoose from "mongoose";
export 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);
return elems;
}
} As of Mongoose 7, we no longer support using |
Hi @vkarpov15 Just stumbled over this one. Is it possible that there is an overload missing here (we're on Let me know if you'd prefer a new issue. (I also don't know if you'll read this, since it's already closed, so I might open a new issue in a few days anyway). |
types(model): add no-generic override for `insertMany()` with options
Prerequisites
Mongoose version
7.6.3
Node.js version
18.x
MongoDB server version
6.x
Typescript version (if applicable)
5.2.2
Description
This is the same issue previously reported in #13957
I have included the code that reproduces it below.
Basically with the code below
the assignment inside the

insertMany
function generates the following errorSteps to Reproduce
https://github.com/ksyd9821/mongoose-insert-many-issue
Expected Behavior
No response
Tasks
The text was updated successfully, but these errors were encountered: