You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched existing issues to ensure the bug has not already been reported
Mongoose version
7.4.5
Node.js version
16
MongoDB server version
N/A
Typescript version (if applicable)
N/A
Description
When using discriminator sub schema fields are processed before the base schema fields but according to mongoose documentation the fields should be processed in order of their definition in schema.
In my use case, I need to set and validate values of the sub schema fields according to a field of base schema. But since sub schema fields are processed first the base schema fields are coming to be undefined in sub schema field's setters and validators.
Prerequisites
Mongoose version
7.4.5
Node.js version
16
MongoDB server version
N/A
Typescript version (if applicable)
N/A
Description
When using discriminator sub schema fields are processed before the base schema fields but according to mongoose documentation the fields should be processed in order of their definition in schema.
In my use case, I need to set and validate values of the sub schema fields according to a field of base schema. But since sub schema fields are processed first the base schema fields are coming to be undefined in sub schema field's setters and validators.
Steps to Reproduce
Expected Behavior
The setters & validators of base class fields should be processed before sub class fields
The text was updated successfully, but these errors were encountered: