更新时间:2023-12-03 21:09:28
由于猫鼬模块导出了单例对象,因此您不必在test.js
中进行连接即可检查连接状态:
Since the mongoose module exports a singleton object, you don't have to connect in your test.js
to check the state of the connection:
// test.js
require('./app.js'); // which executes 'mongoose.connect()'
var mongoose = require('mongoose');
console.log(mongoose.connection.readyState);
就绪状态为: