Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 MongoDB $inc 有一个奇怪的问题。如果脚本重新启动,.update() 函数将从 0 重新启动并且不使用数据库的当前值。代码如下所示:
exports.stats.update({n:name},{$inc: {t:1,s:num}}, {safe:true}, function(err){ if(err) console.log(err);
有什么方法可以从当前值开始 $inc 还是有一些技巧可以避免这种行为?
希望有人对这个问题有一些解决方案。
丹尼尔