gpt4 book ai didi

swift - 基于 uid 交叉 randomKey 从 firebase 获取数据的好解决方案

转载 作者:行者123 更新时间:2023-11-28 14:57:30 24 4
gpt4 key购买 nike

我无法更改数据库结构。我想获得所有具有特定 uid 的匹配项作为图片。我不知道如何跨越 randomKey。我的解决方案是在节点的顶层添加一个uid,然后与randomKey下的uid进行比较。

enter image description here

最佳答案

由于您可以“添加”但不能“更改”您的结构,因此一个选项是“添加”一个子节点,该子节点代表在该匹配节点下猜测的所有猜测者 uid。顺序或计数并不重要,因为我们只想返回匹配节点(match_id_1、match_id_2 等)

matches
match_id_1
TzEnmFC: true
Tss9S9i: true
T99a0ds: true

然后执行查询匹配是用户 uid = true

let queryRef = self.ref.child("matches")
let ref = queryRef.queryOrdered(byChild: "some_uid").queryEqual(toValue: true)
ref.observe(.value, with: { snapshot in
//do something with query results
})

关于swift - 基于 uid 交叉 randomKey 从 firebase 获取数据的好解决方案,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49183442/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com