我正在使用以下代码在数组中添加一些内容并增加两个不同的计数器。
该项目被正确推送到数组中,并且pendingSize 正确递增。但是 unRead 永远不会增加。它曾经增加,然后今天它停止了。我的 mongodb 集合(托管在 mongohq 上)中 unRead 字段的值设置为 0(数字,而不是字符串)
当我查看控制台时,我看到“更新成功”。
任何线索为什么它停止工作?
谢谢
Notifications.update({ "id" : theid}, { $push: { pending: notification}, $inc: { unRead : 1 }, $inc: { pendingSize: 1 }}, function(err){
if(err){
console.log('update failed');
callback("Error in pushing." + result.members[i]);
}
else{
console.log('update succes');
callback("Success");
}
});