【发布时间】:2018-01-03 13:00:17
【问题描述】:
是否可以将帖子上传到 Firebase 到 3 个不同的位置,并且具有相同的 autoId 感觉帖子完全相同。所以我刚刚设法让用户删除他们的帖子,但是当他们上传帖子时,它实际上被上传到了像这样的 3 个不同的位置
// this uploads the "post" to a global page
Database.database().reference().child("posts").childByAutoId().setValue(postObject)
// this uploads the "post" to a specific country page the user have choosen
Database.database().reference().child("AlbaniaPosts").childByAutoId().setValue(postObject)
// this uploads the "post" to the users uid so all their posts will be shown at the profile page
Database.database().reference().child(uid!).childByAutoId().setValue(postObject)
当它们保存在 firebase 中时,它们会保存为不同的 childByAutoId,所以我想知道是否可以将它们全部保存在同一个 childByAutoId ID 中。
因此,如果用户删除了特定帖子,那么我可以搜索他们删除的 AutoId,并将其从所有国家/地区和个人资料页面以及全球页面中删除,但我现在感觉不到我将帖子上传到不同的身份证
所以如果仍然难以理解我的问题,这里是我的数据库的图像
如您所见,帖子完全相同,但它们保存在不同的AutoId's
目标?我的目标是在所有 3 个位置上传帖子时为帖子设置相同的 ID。
非常感谢您的帮助。 感谢您的宝贵时间。
【问题讨论】:
标签: iphone firebase firebase-realtime-database swift4