From 6abb3c7192ce6ddf85f6d8b1ae9284905da07af2 Mon Sep 17 00:00:00 2001 From: Lucien Date: Tue, 16 Jul 2019 23:27:27 +0800 Subject: [PATCH] fixed: global plugins in app.config.mongoose.client --- lib/mongoose.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/mongoose.js b/lib/mongoose.js index 336341d..390e731 100644 --- a/lib/mongoose.js +++ b/lib/mongoose.js @@ -9,7 +9,7 @@ const filterURLPassword = require('./filterURLPassword'); let count = 0; module.exports = app => { - const { client, clients, url, options, defaultDB, customPromise, loadModel, plugins } = app.config.mongoose; + let { client, clients, url, options, defaultDB, customPromise, loadModel, plugins } = app.config.mongoose; // compatibility if (!client && !clients && url) { @@ -18,6 +18,9 @@ module.exports = app => { options, }; } + if (client && client.plugins) { + plugins = client.plugins; + } mongoose.Promise = customPromise ? customPromise : Promise;