我在app.js里面用mongoose.connect连接好了数据库,然后在其他模块里require(‘mongoose’).connection.once(‘open’)怎么触发不了啊,阻塞在那儿,不是说打开一次就好了,然后其它地方都是使用这个默认的连接吗
PHP中文网2017-04-17 15:27:47
Are other modules separated from app.js? Under normal circumstances, other modules will be imported into app.js for execution, so that other modules do not need to worry about the database connection, and can be connected only once in app.js.