[英]Adding onto a map field of a specific document (Flutter Firestore)
I am using flutter
firestore and want to only add users(using the userInfo map) (and not add any other fields) to a specific document in my PrayerRooms Collection.I am unsure of how to do this and whether this is possible The database I want to add into我正在使用
flutter
firestore 并且只想将用户(使用 userInfo 映射)(而不是添加任何其他字段)添加到我的 PrayerRooms 集合中的特定文档。我不确定如何执行此操作以及这是否可能数据库我想加入
If you have other fields and you just want to add data to the userInfo
map while keep the other fields, then you can use updateData()
:如果您有其他字段,并且只想向
userInfo
map 添加数据,同时保留其他字段,则可以使用updateData()
:
Firestore.instance.collection("PrayersRoom").document(userId).updateData({
"userInfo.userId" : userId,
"userInfo.userCount" : 2
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.