You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
6.12.0
Node.js version
16.20.1
MongoDB server version
4.4.x
Typescript version (if applicable)
4.9.5
Description
Using any options ({ordered: false}) with Model.InsertMany causes the return type to change. In the example I've forced the type parameter to cause a typescript error, but this also causes a problem without it. As we are inserting an array but there is no overload for this, it defaults to the 'single' insertion response type which is incorrect.
The issue is also present in mongoose 7.
#13904 seems closely related but not exactly, so I've decided to open a new issue.
Prerequisites
Mongoose version
6.12.0
Node.js version
16.20.1
MongoDB server version
4.4.x
Typescript version (if applicable)
4.9.5
Description
Using any options (
{ordered: false}
) with Model.InsertMany causes the return type to change. In the example I've forced the type parameter to cause a typescript error, but this also causes a problem without it. As we are inserting an array but there is no overload for this, it defaults to the 'single' insertion response type which is incorrect.The issue is also present in mongoose 7.
#13904 seems closely related but not exactly, so I've decided to open a new issue.
Steps to Reproduce
Expected Behavior
Normal options should not change the return type of InsertMany
The text was updated successfully, but these errors were encountered: