mongoose 4.0.3
node 0.10.22
mongod db version 3.0.1
I'm trying to drop a collection using moongoose, but it isn't working
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);
});
}
This returns data2 is undefined
I tried to follow the answers based on this question :Mongoose.js: remove collection or DB