python - (Pyrebase) 错误 : orderBy must be a valid JSON encoded path

标签 python json firebase nosql pyrebase

我使用 firebase,我的 JSON(Firebase) 如下。
我想使用 检索键值( 288xxx ) busStopName 值。
enter image description here
我的代码如下。我将用' 做一个例子윤정사앞 '

# 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 .
但是有错误,它们是' 错误请求 ' 和 ' orderBy 必须是有效的 JSON 编码路径 '。
请帮我...

最佳答案

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

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

关于python - (Pyrebase) 错误 : orderBy must be a valid JSON encoded path,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57267066/

相关文章:

javascript - jQuery 和 JSON : loop json array

python - 如何使用 Python 跳过 Json 文件中的字段

javascript - AngularJS 1.3.8 中的 "Argument ' BrowseController ' is not a function, got undefined"

ios - DispatchGroup 仅当方法被调用两次时才会退出

python - 列之间的相关性 python blaze

java - Python或Java模块在服务器端渲染HTML页面并获取DOM对象

java - 如何将 Mule ESB 中的数据映射器转换为多个连接器以使用社区运行时?

node.js - Firebase 在 promise 触发之前等待加载数据库数据

python - scipy.stats.zipf 中的参数是什么意思?

python - 自定义 __del__ 不存在?