【问题标题】:(Pyrebase) error : orderBy must be a valid JSON encoded path(Pyrebase) 错误:orderBy 必须是有效的 JSON 编码路径
【发布时间】:2019-12-07 13:47:24
【问题描述】:

我使用 firebase,我的 JSON(Firebase) 如下。 我想使用 busStopName 值检索键值(288xxx)。

我的代码如下。我会用'윤정사앞'

做一个例子
# Retriving id by using value
def getIdByName(db, name) :
    bus = db.child("busStops").order_by_child("busStopName").equal_to(name).get()
    print(bus.key())
...

...
getIdByName(db, "윤정사앞")

我对这段代码的理想结果是 288000001。 但有错误,即“Bad Request”和“orderBy must be a valid JSON encoding path”。

请帮帮我...

【问题讨论】:

    标签: python json firebase nosql pyrebase


    【解决方案1】:

    您必须进入 firebase 中的规则,并更新您可以做到的规则。 在规则中,在 firebase 中,您需要更新:

    {
      "rules": {
        ".read": ...
        ".write": ...
          "busStops": {
             ".indexOn": "busStopName"
         }
      }
    }
    

    【讨论】:

    猜你喜欢
    • 2022-08-04
    • 2016-03-28
    • 2023-03-25
    • 2017-02-23
    • 1970-01-01
    • 2020-10-24
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    相关资源
    最近更新 更多