We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bc465fc commit 2c3ffb9Copy full SHA for 2c3ffb9
src/property.ts
@@ -70,10 +70,13 @@ class Property extends BaseProperty {
70
}
71
72
reference() {
73
- if (this.isArray()) {
74
- return this.mongoosePath.caster.options && this.mongoosePath.caster.options.ref
75
- }
76
- return this.mongoosePath.options && this.mongoosePath.options.ref
+ const ref = this.isArray()
+ ? this.mongoosePath.caster.options?.ref
+ : this.mongoosePath.options?.ref
+
77
+ if (typeof ref === 'function') return ref.modelName
78
79
+ return ref
80
81
82
isVisible() {
0 commit comments