SomeSchema.statics.findAndModify = function (query, sort, doc, options, callback) {
return this.collection.findAndModify(query, sort, doc, options, callback);
};
mongoose.model('Some',SomeSchema);
然后findAndModify
Some.findAndModify({}, [], { $inc: { amount: 1 } }, {'new':true}, function (err) {
if (err) throw err;
});
似乎成功的给amount加了1,但是我想直接取得新amount的值,有办法么?