diff --git a/lib/mongoose.js b/lib/mongoose.js index 34838a8..faf3a55 100644 --- a/lib/mongoose.js +++ b/lib/mongoose.js @@ -99,8 +99,8 @@ function createOneClient(config, app) { } function loadModelToApp(app) { - const dir = path.join(app.config.baseDir, 'app/model'); - app.loader.loadToApp(dir, 'model', { + const dirs = app.loader.getLoadUnits().map(unit => path.join(unit.path, 'app/model')); + app.loader.loadToApp(dirs, 'model', { inject: app, caseStyle: 'upper', filter(model) {