这是我的收藏:
{
"_id" : "Kan6btPXwNiF84j8e",
"title" : "Chapter Title 1",
"businessId" : "qmWJ3HtZrpka8dpbM",
"createdBy" : "GfdPfoPTiSwLv8TBR",
"sections" : [
{
"id" : "T5KAfTcCb7pCudT3a",
"type" : "TEXT",
"data" : {
"text" : "<h1>2</h1><h1>asd</h1>"
},
"createdAt" : ISODate("2016-12-03T10:35:59.023Z"),
"updatedAt" : ISODate("2016-12-03T10:35:59.023Z")
}
],
"createdAt" : ISODate("2016-12-02T12:15:16.577Z"),
"updatedAt" : ISODate("2016-12-03T12:54:50.591Z")
}
这是我从客户端调用的流星方法
deleteSection: function (section_id, chapter_id) {
chaptersCollection.update(
{$and: [{_id: chapter_id}, {'sections.id': section_id}]},
{$pull: {'sections': {'id': section_id}}},
function (err, numAffected) {
if (err) {
console.log(err);
return err;
}else{
console.log(numAffected);
}
});
return 'Section Successfully Deleted';
}
在meteor方法的回调函数中,它返回1作为受影响的行。但是在服务器文档上没有更新。
有什么建议我哪里错了吗?