📜  猫鼬切换数据库 - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:35.989000             🧑  作者: Mango

代码示例1
// create a connection to a database
var db = mongoose.createConnection(uri);

// use another database without creating additional connections
var db2 = db.useDb('someDbName');

// proceed as you would normally
var Model1 = db.model('Model1', m1Schema);
var Model2 = db2.model('Model2', m2Schema);