繁体   English   中英

添加到特定文档的 map 字段 (Flutter Firestore)

[英]Adding onto a map field of a specific document (Flutter Firestore)

我正在使用flutter firestore 并且只想将用户(使用 userInfo 映射)(而不是添加任何其他字段)添加到我的 PrayerRooms 集合中的特定文档。我不确定如何执行此操作以及这是否可能数据库我想加入

如果您有其他字段,并且只想向userInfo map 添加数据,同时保留其他字段,则可以使用updateData()

 Firestore.instance.collection("PrayersRoom").document(userId).updateData({
                     "userInfo.userId" : userId,
                     "userInfo.userCount" : 2
                   });

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM