![](/img/trans.png)
[英]How to perform a multi-path data update on Firebase when data is changed from the Firebase Console?
[英]Firebase multi-path update with childByAutoId possible?
是否可以将Firebase的多路径更新功能与创建子节点(使用auto-id)结合使用? 到目前为止,我发现只有完整路径才知道的更新解决方案。
例如
var newData = [String: AnyObject]()
newData["conversations/messages/<placeholder for new id>"] = newMessage
newData["conversations/somethingDifferent"] = additionalData
...
在客户端上生成Push-id。 childByAutoId
返回一个新的Firebase
,但不通过网络发送数据。
let ref = Firebase(url: "<my-firebase-app>")
let childRef = ref.childByAutoId()
var newData = [String: AnyObject]()
newData["conversations/messages/\(childRef.key)"] = newMessage
创建子引用后,只需在字典中使用其键进行多路径更新即可。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.