File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -161,10 +161,10 @@ class TMongoDBPlugin extends TAbstractDatabasePlugin {
161161
162162 _registerTypes ( Mongoose ) {
163163
164- for ( let typeWrapper of this . _types ) {
164+ for ( let type of this . _types ) {
165165
166- console . log ( `Register type: ${ typeWrapper . name } ` )
167- typeWrapper ( Mongoose )
166+ console . log ( `Register type: ${ type . name } ` )
167+ type ( Mongoose )
168168
169169 }
170170
@@ -175,7 +175,22 @@ class TMongoDBPlugin extends TAbstractDatabasePlugin {
175175 for ( let schema of this . _schemas ) {
176176
177177 console . log ( `Register schema: ${ schema . name } ` )
178- schema ( Mongoose )
178+
179+ if ( isFunction ( schema ) ) {
180+
181+ console . log ( `Direct register local database schema: ${ schema } ` )
182+ schema ( Mongoose )
183+
184+ } else if ( isFunction ( schema . registerModelTo ) ) {
185+
186+ console . log ( `Register local database schema: ${ schema } ` )
187+ schema . registerModelTo ( Mongoose )
188+
189+ } else {
190+
191+ console . error ( `Unable to register local database schema: ${ schema } ` )
192+
193+ }
179194
180195 }
181196
You can’t perform that action at this time.
0 commit comments