-
-
Notifications
You must be signed in to change notification settings - Fork 3.8k
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
Static variables declared on advanced schemas are not loaded into the model #10206
Comments
This isn't standard javascript so we need to know more about your set up if we are going to attempt to repro this issue. Alternatively, you can provide a script with notes about your setup that demonstrates this problem. |
Here is the code to reproduce this issue:
|
This applies to the person class so
will return undefined but
|
Sure, but the static method Otherwise the workaround I'm currently doing is duplicating the static variable and adding it to the schema statics, as you can see on the commented lines of code |
We'll be implementing this soon |
When declaring a static variable on a class loaded with
loadClass
into the schema, the static variable does not get loaded into the model.In order for it to work, you need to explicitly declare the static variable through the classic function property
schema.statics
approach.In order to reproduce:
Mongoose v5.9.2
The text was updated successfully, but these errors were encountered: