0

books 配列を含むドキュメントがあります

"_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')));

しかし、私が使用するクエリはそれを更新しません。

4

1 に答える 1