我使用MongoDB的我site.When我尝试运行“findAndModify”功能,我总是那个文件夹是“未定义”:使用“findAndModify”有关MongoDB
function counter(name) {
var doc = this.db.collection('counter').findAndModify(
{ query: { _id: name },
update: { $inc: { next: 1} },
new: true,
upsert: true });
return doc.next;
}
问:我在想什么?
什么版本的MongoDB是您目前以怎样的驱动程序运行?如果你通过shell来试试这个,你的结果是什么? – Bill 2012-03-11 14:17:02
我使用2.0.3。如果我检查壳体,它的工作原理 – user541847 2012-03-12 15:36:20