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

Getters are not called on sub-schemas unless they are a array #12105

Closed
2 tasks done
hasezoey opened this issue Jul 14, 2022 · 0 comments
Closed
2 tasks done

Getters are not called on sub-schemas unless they are a array #12105

hasezoey opened this issue Jul 14, 2022 · 0 comments
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Milestone

Comments

@hasezoey
Copy link
Collaborator

Prerequisites

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

Mongoose version

6.4.4

Node.js version

18.5.0

MongoDB server version

any

Description

Currently when using getters on a sub-schema and enabling toJSON: { getters: true } on the sub-schema, but not in the top-schema, they wont get added, unless the top-schema defines the nested schema as a array

Steps to Reproduce

Reproduction repository + branch: https://github.com/typegoose/typegoose-testing/tree/gettersNotCalled (follow the README#Setup)

Commit with the base example (not arrays): e013ce3f2d4c5827973753c2ef72f4655e7e9e33
Commit with the arrays: 06764561a634d15e791d391736874928d9b17169

Expected Behavior

To have the behavior consistent across both cases (either dont apply getters or apply getters in both cases)

@vkarpov15 vkarpov15 added this to the 6.4.7 milestone Jul 18, 2022
@IslandRhythms IslandRhythms added the confirmed-bug We've confirmed this is a bug in Mongoose and will fix it. label Jul 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
confirmed-bug We've confirmed this is a bug in Mongoose and will fix it.
Projects
None yet
Development

No branches or pull requests

3 participants