$ inc与mongoose被忽略

我正在使用下面的代码来在数组中添加一些内容并增加两个不同的计数器。

该项目被正确推入数组中,并且pendingSize正确递增。 但是unread不会增加。 它用来增加,然后今天停止。 我的mongodb集合(在mongohq上)的unread字段的值被设置为0(数字,而不是string)

当我看着我的控制台,我看到“更新成功”。

任何线索为什么停止工作?

谢谢

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"); } }); 

将$ inc的参数组合成一个嵌套的对象,如下所示:

 $inc: { unRead : 1, pendingSize: 1 } 

以JSON表示的对象是key:value,其中键必须是唯一的,所以试图为$inc指定多个值将不起作用。