[英]how to use firestore wherefield method and adding document that collection to another collection
我正在做一个使用商店的项目。 我的结构数据:
我的代码片段
//current user sign in here and uid "VjZfKF1zmrV00C9VeTZxRmogybA2"
let currentUser = Auth.auth().currentUser
let db = Firestore.firestore()
db.collection("Blah").whereField("users", isEqualTo: currentUser?.uid).collection("otherPath").document().addDocument
我想添加数据以使用 currentuser uid,如果它在文档中匹配“Blah”,则将该目标文档添加到其他集合。
.adddocumets
或.setData
不允许 firestore,所以我怎么知道呢?
无法在一个 go 中向 Firestore 发送查询和更新语句。您必须:
此外,由于users
是一个数组字段,您需要使用array-contains
运算符来匹配正确的文档。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.