We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I insert some configs in app object, and I hope to get it in mongoose plugins, can this feature be added. And I think it can be handled this way.
module.exports = app => { const { client, clients, url, options, defaultDB, customPromise, loadModel, plugins, aPlugins } = app.config.mongoose; ... if (Array.isArray(aPlugins)) { aPlugins.forEach(plugin => { mongoose.plugin.apply(mongoose, insertApp(app, plugin)); }); } ... }; function createOneClient(config, app) { const { url, options, plugins, aPlugins } = config; ... [].concat(plugins || [], (aPlugins || []).map(plugin => insertApp(app, plugin)), globalPlugins).forEach(plugin => { mongoose.plugin.apply(mongoose, Array.isArray(plugin) ? plugin : [ plugin ]); }); ... } ... function insertApp(app, plugin) { if (Array.isArray(plugin)) { plugin[0] = plugin[0](app); return plugin; } return [ plugin(app) ]; }
config like this
exports.mongoose = { url: process.env.MONGODB_URL_3, options: {}, aPlugins: [ lastModifiedPlugin, [ lastModifiedPlugin, { field: 'updatedAt' }]], };
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I insert some configs in app object, and I hope to get it in mongoose plugins, can this feature be added.
And I think it can be handled this way.
config like this
The text was updated successfully, but these errors were encountered: