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