Skip to content

setDefaultsOnInsert type broken in 8.1.0 #14282

@richardsimko

Description

@richardsimko

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions