0

次のような構造のユーザードキュメントがあります。

{
"_id" : ObjectId("5173b10fd0aa9af00d06395c"),
"customer_id" : 1,
"customer_fullname" : "Douglas E. Kelly",
"customer_email" : "1@1.com",
"customer_cityid" : "1",
"customer_selections" : [15, 952, 17347, 343102, 20380, 51757, 235961, 119824, 134011,   168251, 297596, 175792, 196010, 210349, 226945, 250102, 274064, 328834, 354893, 472868,  555878]
}

そこで「顧客選択」の番号・項目を削除したい。どうすればこれを行うことができますか?

更新: このクエリを使用しています。しかし、それは番号を削除しません

  $response=$collection->update(array('customer_id' =>1), array('$pull' => array('customer_selections'=>$selectedcompanyid)));

var_dump($応答);

 array(5) { ["updatedExisting"]=> bool(true) ["n"]=> int(1) ["connectionId"]=> int(3) ["err"]=> NULL ["ok"]=> float(1) }
4

1 に答える 1