In node.js, modules loaded with require
are cached so that calling require('mongoose')
in two different files returns the same instance of the mongoose
module.
So while variables from one file are not directly accessible in other files, variables within the same module are effectively shared between the files that require
that module.