我有一个代码,我正在使用猫鼬和使用架构也建立一个新的连接。连接做得很好,我也从集合中获取属性。从那以后,我想在我的收藏更新,并且不工作..我下面的代码由id更新不工作在猫鼬
console.log("id : "+content._id);
Alert.findByIdAndUpdate(content._id, {
$set: {
status: true
}
}, function(error, result) {
console.log(result);
if (error) console.log(error);
else {
console.log('Alert updated');
}
});
它显示警报更新,但状态仍然为假..
result for 1st console is
id : 55096a5f91169c8e1673af20;
and 2nd console is
Alert updated
感谢,并提前问候
您可以编辑您的问题,包括你的架构和你试图更新文档? – JohnnyHK 2015-04-01 12:54:08