Skip to content

How to add custom properties on class? #712

Answered by hasezoey
Kuzzy asked this question in Q&A
Discussion options

You must be logged in to vote

I think you are expecting your non-prop field to have a default value, which will not work because mongoose does not "officially" support such properties and so typegoose does not translate any properties that do not have a @prop on them.

The reason why typegoose also does not support it is because the documents / models are not actually instances of the class you have created, classes in typegoose are basically just a combined place to have options, types and runtime schema.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@Kuzzy
Comment options

Answer selected by Kuzzy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants