如何从Firebase中的值获取密钥?

2024-10-08 19:26:52 发布

您现在位置:Python中文网/ 问答频道 /正文

我的火基结构如下。 我用python来使用firebase, 我也用Pyrebase。你知道吗

我想要一把钥匙,看起来像“288xxxxxx” 从值(busStopName)开始。 我能在Pyrebase得到答案吗?你知道吗

先谢谢你。。。你知道吗

enter image description here


Tags: 答案结构钥匙firebasepyrebasebusstopname
1条回答
网友
1楼 · 发布于 2024-10-08 19:26:52

基于documentation,下面应该可以工作

searched_bus = db.child("asanbus").order_by_child("busStopName").equal_to("XYZ").get()
for bus in searched_bus.each():
    print(bus.key()) 

假设:只有一条记录对应于busStopname = "XYZ"。如果不是这样,您可以:

searched_bus = db.child("asanbus").order_by_child("busStopName").equal_to("XYZ").limit_to_first(1).get()

相关问题 更多 >

    热门问题