我在mongo集合中的文档中有数组,我需要删除“phone”数组中的所有对象。
"_id": "id",
"email": "Name@google.com",
"phone": {
"1": "+1 00000000000",
"2": "+1 00000000000",
"3": "+1 00000000000",
"4": "+1 00000000000",
"5": "+1 00000000000",
"6": "+1 00000000000",
"7": "+1 00000000000",
"8": "+1 00000000000",
"9": "+1 00000000000"
}
如果我使用:
$email = "Name@google.com";
$col->update(array("email"=>$email), array('$unset'=>array("dictionary"=> true)));
我删除了所有和“手机”数组,如何删除所有对象,在我的文档中保存“手机”数组?