From the node.js documentation:
Modules are cached after the first time they are loaded. This means (among other things) that every call to require(\'
Following two step procedure is working perfectly for me.
After changing Model
file i-e 'mymodule.js'
dynamically, you need to Delete precompiled model in mongoose model first then reload it using require-reload
Example:
// Delete mongoose model
delete mongoose.connection.models[thisObject.singular('mymodule')]
// Reload model
var reload = require('require-reload')(require);
var entityModel = reload('./mymodule.js');