2 回答
宝慕林4294392
TA贡献2021条经验 获得超8个赞
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 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 assert = require('assert'); var doc1=new model1({name:'doc1'}); doc1.save(function(err){ assert.equal(null,err); }); var doc2=new model2({num:2}); doc2.save(function(err){ assert.equal(null,err); }); |
- 2 回答
- 0 关注
- 1361 浏览
添加回答
举报
0/150
提交
取消