【发布时间】:2015-08-17 23:48:09
【问题描述】:
猫鼬 4.0.3
节点 0.10.22
mongod db 3.0.1 版
我正在尝试使用 moongoose 删除一个集合,但它不起作用
run: function() {
return Q(mongoose.connect('mongodb://127.0.0.1:27017/test',opts))
.then(function(data){
return Q(mongoose.connection.db.dropCollection('departments'))
.then(function(data2){
console.log('data2 is ',data2);
return Q(true);
}).catch(function(err){
console.log('err is',err);
return Q(false);
});
}).catch(function(err){
console.log('err is', err);
return Q(false);
});
}
这会返回data2 is undefined
我试图根据这个问题来回答答案:Mongoose.js: remove collection or DB
【问题讨论】:
标签: javascript node.js mongodb mongoose q