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
There is no proper documentation available on how to use a ref / refPath as functions in a schema.
Also, I want to understand what is the intended behaviour of these functions? Whether they are called only once during the schema initialization phase and cache the function return value or these functions are executed for each document.
The typescript mentions that these functions have access to this and doc so, is that mean that these functions will have access to document while processing and we can use document's fields to manipulate returned model or modelName
The only mention of ref function is here but it doesn't explains the above questions
vkarpov15
added
docs
This issue is due to a mistake or omission in the mongoosejs.com documentation
and removed
help
This issue can likely be resolved in GitHub issues. No bug fixes, features, or docs necessary
help wanted
labels
Sep 18, 2023
Prerequisites
Mongoose version
7.5.0
Node.js version
N/A
MongoDB version
N/A
Operating system
None
Operating system version (i.e. 20.04, 11.3, 10)
No response
Issue
There is no proper documentation available on how to use a ref / refPath as functions in a schema.
Also, I want to understand what is the intended behaviour of these functions? Whether they are called only once during the schema initialization phase and cache the function return value or these functions are executed for each document.
The typescript mentions that these functions have access to

this
anddoc
so, is that mean that these functions will have access to document while processing and we can use document's fields to manipulate returned model or modelNameThe only mention of ref function is here but it doesn't explains the above questions
Use Case:
The text was updated successfully, but these errors were encountered: