firebase通过嵌套的子id获取树的URL [英] firebase get url by nested child id for tree like
问题描述
我在firebase中具有以下结构:
I have following structure in firebase:
data/users/<id_user>/lists/<id_list>/children/<child1_id>/children/<child2_id>
如何在知道唯一的child2_id的情况下获取此完整URL?
how to get this full URL, knowing the only child2_id?
(最好是打字稿,angularfire 2)
(preferably typescript, angularfire 2)
推荐答案
Firebase Realtime数据库查询可以搜索位置的子节点.但是,您搜索的值必须位于每个孩子下方的固定路径上.
Firebase Realtime Database queries can search the child nodes of a location. But the value you search for must be at a fixed path under each child.
因此,如果您知道 data/users/< id_user>/lists/< id_list>/children/< child1_id>
,则可以使用查询以查找该子项下的子项child2_id
.但是您无法跨多个嵌套的未知路径搜索 child2_id
.
So if you know data/users/<id_user>/lists/<id_list>/children/<child1_id>
, you can query to find the child under that with child2_id
. But you can't search for child2_id
across multiple nested unknown paths.
有关更多信息,请参见 Firebase Query Double Nested ,并且可能(取决于您的用例) Firebase查询,如果child的child包含值.
For more on this, see Firebase Query Double Nested, and possibly (depending on your use-case) Firebase query if child of child contains a value.
这篇关于firebase通过嵌套的子id获取树的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!