0
我有一個包含書籍陣列爲什麼此查詢不更新mongodb字段值?
"_id" : ObjectId("517b80cf9de5ee780b000003"),
"publisher_name" : "ABC",
"books" : [{
"_id" : ObjectId("517b80cf9de5ee780b000000"),
" title" : "<b>AAA</b>",
"published" : 1
}, {
"_id" : ObjectId("517b80cf9de5ee780b000001"),
" title" : "<b>BBB</b>",
"published" : 1
}, {
"_id" : ObjectId("517b80cf9de5ee780b000002"),
" title" : "<b>CCC</b>",
"published" : 1
}],
我想更新域「發表」設置爲「0」
$theObjId = new MongoId($bookid);
$collection->update(array("_id" => $theObjId), array('$set' => array('published'=> '0')));
但是我用查詢不更新的文件。