flutter - 如何使用颤振在 FireStore Mappage 中添加元素
问题描述
在 firestore 中,我有一个包含属性映射的文档。该属性包含或可以包含很多键/值。
但是不知道怎么给这个属性加上key/values
我知道,要添加到我们可以使用的列表中FieldValue.arrayUnion([userUid])
。
我试过了
firestore.collection(questionCollection).document(object.id).updateData({attributeMapping: {key: FieldValue.increment(1)}});
但这会删除已插入的其他键/值。
有人可以帮助我吗?
谢谢
解决方案
经过长时间的搜索,我最终解决了我的问题。如果对某人有帮助,我将答案放在这里
firestore.collection(questionCollection).document(object.id).setData({attributeMapping: {key: FieldValue.increment(1)}}, merge: true);
推荐阅读
- reactjs - ReactJS FullCalendar 不会将事件加载到日历中
- c - 如何将在命令行上键入的行存储到 C 中的缓冲区中?
- list - 如何对具有预定组大小的组进行排序?
- javascript - 如何使用 1 个全局内存数组在 JavaScript 中模拟带有参数和局部变量的调用堆栈?
- asp.net - What specs should I use for my .NET webapp on Azure, or something similar?
- php - 我可以用这个“用户'root'@'10.0.1.168'的访问被拒绝(使用密码:YES)”做什么?
- flutter - Flutter AnimatedSize 仅在一个方向上起作用
- javascript - 使用 Javascript 使用按钮添加和清除 geojson?
- python - 错误:函数调用的结果不是正确的浮点数组
- azure - 使用 Terraform 获取 Azure 资源