4

I use firebase and my JSON(Firebase) is as below. I want to retrieve the key values(288xxx) by using busStopName values.

enter image description here

My code is as below. I'll make an example with '윤정사앞'

# 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, "윤정사앞")

My ideal result of this code was 288000001. But there are errors, which are 'Bad Request' and 'orderBy must be a valid JSON encoded path'.

Please help me...

hjpoe
  • 96
  • 10
Jung Jaehoon
  • 101
  • 1
  • 12

1 Answers1

0

You have to go into rules in firebase, and update rules that you can do it. In rules, in firebase, you need to update this:

{
  "rules": {
    ".read": ...
    ".write": ...
      "busStops": {
         ".indexOn": "busStopName"
     }
  }
}
  • I think this is for performance, and not required. The issue might be this: https://github.com/thisbejim/Pyrebase/issues/296 – John Henry May 27 '21 at 05:51