我想使用mongodb
使用createConnection
而不是mongoose
的两个数据库。
exports.mongooseMaster = mongoose.createConnection('mongodb://192.168.2.10:27017/Master', function (err, res) {
if (err) {
console.log ('ERROR connecting to: remote Master ' + err);
} else {
console.log ('Successfully connected to: remote Master');
}
});
// Connect to Database
exports.mongoosetime = mongoose.createConnection('mongodb://192.168.2.10:27017/Planner2', function (err, res) {
if (err) {
console.log ('ERROR connecting to: remote Planner2 ' + err);
} else {
console.log ('Successfully connected to: remote Planner2');
};
});
当我执行此代码时,我看到只有Planner2数据库创建的不是Master数据库。但是我在控制台中获得了这些内容
Successfully connected to: remote Master
Successfully connected to: remote Planner2
会出现什么问题?