![](/img/trans.png)
[英]Firestore - How do I add a new key value pair to a document containing a list of maps?
[英]How to update maps in a document in firestore with a list of items
您可以嘗試從該列表創建一個 map:
var myList = ["a", "d"];
var myMap = { for (var item in myList) 'test.$item': FieldValue.increment(1) };
print(myMap);
// {test.a: FieldValue.increment(1), test.d: FieldValue.increment(1)}
firestore.collection('x').doc('y').update(myMap)
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.