nodejs怎么同步从一个数据库查询函数中返回一个值
1个回答
2017-09-20
展开全部
nodejs怎么同步从一个数据库查询函数中返回一个值
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var schema1 = new Schema({ name: String });
var schema2 = new Schema({ num: Number});
var conn1 = mongoose.createConnection("mongodb://localhost/A表");
var conn2 = mongoose.createConnection("mongodb://localhost/B表");
var model1 = conn1.model('model1',schema1);
var model2 = conn2.model('model2',schema2);
var mongoose = require('mongoose');
var Schema = mongoose.Schema;
var schema1 = new Schema({ name: String });
var schema2 = new Schema({ num: Number});
var conn1 = mongoose.createConnection("mongodb://localhost/A表");
var conn2 = mongoose.createConnection("mongodb://localhost/B表");
var model1 = conn1.model('model1',schema1);
var model2 = conn2.model('model2',schema2);
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询