0
我已經在測試新的Firestore
API,並且在處理文檔和調用update
時遇到了一些問題。Firestore數據庫:更新丟失的文檔
我試圖更新一個沒有現有文件,我收到一個錯誤。顯然這沒問題,因爲文檔說如果DocumentReference
不存在,update
調用將會失敗。然而,讀official documentation我看到的一個代碼塊:
// Update the population, creating the document if it
// does not already exist.
db.collection("cities").document("Beijing").update(
new UpdateOptions().createIfMissing(),
"population",
21500000);
我試圖複製,但我沒有找到UpdateOptions
電話。此外,檢查update
的不同覆蓋方法,這些調用不是構造函數。
我使用的是Firebase的11.4.2
版本。有什麼想法發生了什麼?
非常感謝你提前。