I have a strange problem with MongoDB $inc. If the script gets restarted the .update() function will restart from 0 and dont use the current value of the database. The code looks like this:
exports.stats.update({n:name},{$inc: {t:1,s:num}}, {safe:true}, function(err){
if(err) console.log(err);
Is there some way to start the $inc from the current value or is there some hack to avoid this behavior?
Hope anybody has some solution for this problem.
Daniel