0

I am developing a web service and is new to pyrebase.. I only want to fetch data from database having key greater than the particular value. click here to see image

suppose I want to fetch data with key value greater than 154711668000 what should I write??

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807

1 Answers1

0

To filter items based on their key, you use order_by_key and start_at:

users_by_key = db.child("users").order_by_key().start_at("154711668000").get()
Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
  • it gives "error" : "orderBy must be a valid JSON encoded path" ..My database looks like this https://drive.google.com/file/d/1Fjr-EzrKr7JdYTpEKPpBzKxzaPTkjjnB/view?usp=sharing and I am writing this code users_by_key = db.child("GPSData").child("08QEz10yBkg4jnfXyasSQjnlaqA2").order_by_key().start_at("1549711666000").get() – saurabh gupta Mar 26 '19 at 06:06
  • Hmm... I don't immediately see what's going wrong there. I got the syntax straight from the Pyrebase docs, so I'm not sure where that error is coming from. – Frank van Puffelen Mar 26 '19 at 13:02
  • it was arising due to this issue https://github.com/thisbejim/Pyrebase/issues/294 . I have fixed it for now – saurabh gupta Mar 28 '19 at 07:29