Skip to content

RawDocType is not accessible trought toObject/toJSON transform function anymore #15521

@PedroLucasHablla

Description

@PedroLucasHablla

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.16.2

Node.js version

22.16.0

MongoDB server version

7.0.21 Atlas

Typescript version (if applicable)

No response

Description

The #15501 PR introduced the ability to retrieve the _id and __v of a document from the ret parameter of the toObject/toJSON transform function. However, by doing so, the RawDocType is no longer accessible through the ret parameter, leading to a series of compilation errors when trying to access a document property, such as:

Image

Steps to Reproduce

Try to access any document property over the ret parameter in the transform() function.

Expected Behavior

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs clarificationThis issue doesn't have enough information to be actionable. Close after 14 days of inactivity

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions