You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Do you want to request a feature or report a bug?
I think it's a bug
What is the current behavior?
I am trying to register a global plugin within a closure with not
If the current behaviour is a bug, please provide the steps to reproduce.
I am trying to bootstrap mongoose with a simple Express.js app. My app sets up a few dependencies and I am trying to pass a global plugin for mongoose within a closure. The console.log does not work at all and the methods are missing from my schemas.
constmongoose=require('mongoose');constconfig={};const{DB_CONNECT}=process.env;constmyPlugin=schema=>{console.log('done');// this line is not executedschema.methods.mymethod=()=>{};}constconnectAndAddPlugins=async()=>{awaitmongoose.connect(DB_CONNECT,{...config});mongoose.plugin(myPlugin)};connectAndAddPlugins();
What is the expected behavior? mymethod shall be present to my internal models.
Please mention your node.js, mongoose and MongoDB version.
node.js: v9.3.0
mongoose: ^5.2.13
MongoDB: v4.0.2
The text was updated successfully, but these errors were encountered:
Do you want to request a feature or report a bug?
I think it's a bug
What is the current behavior?
I am trying to register a global plugin within a closure with not
If the current behaviour is a bug, please provide the steps to reproduce.
I am trying to bootstrap mongoose with a simple Express.js app. My app sets up a few dependencies and I am trying to pass a global plugin for mongoose within a closure. The
console.log
does not work at all and the methods are missing from my schemas.What is the expected behavior?
mymethod
shall be present to my internal models.Please mention your node.js, mongoose and MongoDB version.
node.js: v9.3.0
mongoose: ^5.2.13
MongoDB: v4.0.2
The text was updated successfully, but these errors were encountered: