如何使用php在mongodb中插入内部数组我在sheel中运行这个命令然后它运行
db.domain_data.update({"email":"rohan@walkover.in","url.tlds":".com"},{'$addToSet':{"url.$.domain":{"name":"rohan","status":"yes"}}}})
但我用php编写这段代码然后它不起作用
<?
$domain=array("name"=>"asvdsfs","status"=>"yes");
$condition=array("email"=>"rohan@walkover.in","url"=>array("tlds"=>".com"));
$arr=array('$addToSet'=>array("url.$.domain"=>array($domain)));
//$arr=array('$addToSet'=>array("url"=>array("$"=>array("domain"=>array($domain)))));
//Above line also not working.
$status=$db->domain_data->update($condition,array($arr));
?>
如何编写上面运行正确的 php 代码?