Skip to content
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

setDefaultsOnInsert type broken in 8.1.0 #14282

Closed
2 tasks done
richardsimko opened this issue Jan 23, 2024 · 3 comments · Fixed by #14284
Closed
2 tasks done

setDefaultsOnInsert type broken in 8.1.0 #14282

richardsimko opened this issue Jan 23, 2024 · 3 comments · Fixed by #14284

Comments

@richardsimko
Copy link

richardsimko commented Jan 23, 2024

Prerequisites

  • I have written a descriptive issue title
  • I have searched existing issues to ensure the bug has not already been reported

Mongoose version

8.1.0

Node.js version

20.x

MongoDB server version

6.x

Typescript version (if applicable)

5.3.x

Description

The following code

await FooModel.updateOne(
          { foo: bar },
          { $set: {baz: true} },
          { setDefaultsOnInsert: true },
        );

Results in this type error

Object literal may only specify known properties, and 'setDefaultsOnInsert' does not exist in type 'UpdateOptions & Omit<MongooseQueryOptions<AwardFare>, "lean">'.

From what I can understand setDefaultsOnInsert hasn't been removed in the updated mongo driver version, and if it has this version of Mongoose should had been released as 9.0 and not 8.1.0.

This worked in 8.0.4

Steps to Reproduce

See description

Expected Behavior

No response

@vkarpov15
Copy link
Collaborator

I'm sorry for the inconvenience, this was a mistake that we fixed in #14278. We will ship 8.1.1 with the fix later today.

@vkarpov15 vkarpov15 reopened this Jan 23, 2024
@vkarpov15
Copy link
Collaborator

Actually nvm, I checked and #14278 doesn't fix this particular issue. I'll create a separate PR in a little bit.

vkarpov15 added a commit that referenced this issue Jan 23, 2024
vkarpov15 added a commit that referenced this issue Jan 23, 2024
types(query): add back `context` and `setDefaultsOnInsert` as Mongoose-specific query options
@richardsimko
Copy link
Author

Thanks for the fast response!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants