-
Notifications
You must be signed in to change notification settings - Fork 26
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
Support model ref and function ref #42
Comments
/**
* The model that `populate()` should use if populating this path.
*/
ref?: string | Model<any> | ((this: any, doc: any) => string | Model<any>); |
Never mind, I created https://github.com/lsafer/mongoose-extra-validators to address the issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Explanation
Mongoose allows the field
ref
to be any of:Expected Behavior
When
ref
is a function, the plugin executes the functionWhen
ref
is a model, the plugin takes the name of the modelActual Behavior
The plugin uses the
toString
function the value onref
to get the collection nameThe text was updated successfully, but these errors were encountered: