0
我尝试在文档的MongoDB更新嵌套参数:更新MongoDB中的嵌套参数?
$this->collection->update(
["prototype_id" => $id],
["$set" => ["parameters" => $newdata]],
["upsert" => true, "multiple" => true]);
在结果我得到错误:
zero-length keys are not allowed, did you use $ with double quotes?
其中是:
array:1 [
"5920d086470e6cb30e3c986c" => array:1 [
"Acceleration" => "2"
]
]
什么是您的$ id值和$设置值 –
Php试图插入它认为变量为'“$ set”'。使用单引号传递字符串文字''$ set'' –
它可以工作,但是这个查询在文档中再次插入新的参数,而不是更新 – Blablacar