用bluebird将mongoose中所有的方法进行promise化,当一个model进行update后返回的query变成promise,无法通过exec获取到更新的数据
var Promise = require('bluebird');
var PersonSchema = mongoose.Schema({
name: 'fsy'
});
var Person = mongoose.model('person', PersonSchema);
Promise.promisifyAll(Person);
Promise.promisifyAll(Person.prototype);
//假若db中有一个_id为123的document
Person.update({_id: 123},{name: 'aho'}).exec().then(function(result){
//这里取到的result是更新数据统计
})
//无法通过官网说的exec取到数据 [Model#update](http://mongoosejs.com/docs/api.html#model_Model.update)