如何从数组MongoDB php中提取元素?

如何从数组MongoDB php中提取元素?,php,mongodb,mongoose,Php,Mongodb,Mongoose,我有以下文件: "parameters" : [ { "592193d6470e6cf80d3c9874" : { "Speed" : "1", "Acceleration" : "2" } }] 我需要按键拉动元件592193d6470e6cf80d3c9874 $this->collection->update(['$unset' => ['parameters'=> [

我有以下文件:

"parameters" : [
    {
        "592193d6470e6cf80d3c9874" : {
            "Speed" : "1",
            "Acceleration" : "2"
        }
    }]
我需要按键拉动元件
592193d6470e6cf80d3c9874

$this->collection->update(['$unset' => ['parameters'=> ['_id'] => $id], ['multiple' => true]);
我试过:

 $this->collection->update(
            [],
            ['$unset' => ['parameters' => $id]], ['multiple' => true]);
其中
$id
id
592193d6470e6cf80d3c9874

$this->collection->update(['$unset' => ['parameters'=> ['_id'] => $id], ['multiple' => true]);


$this->collection->update([],['$unset'=>null],['multiple'=>true])$此->集合->更新([],['$unset'=>parameters.$parameterId=>null],['multiple'=>true])。。。。试着你说的拉力是什么意思?是否要删除该文档?它不起作用:
$this->collection->update([],['$unset'=>['parameters..$id=>null]],['multiple'=>true])好的,谢谢,我可以问你,如何添加参数吗?我试过:
$this->collection->update([“prototype_id”=>$id],“$set”=>[“parameters”=>array(array($key=>$data))],[“multiple”=>true])它覆盖了所有参数并且不适用于您的示例,因为参数是数组$this->collection->update(['$unset'=>['parameters'=>[''u id']=>$id],'multiple'=>true]),您能给我您的私人联系人吗?kumarrishikesh12@gmail.com