nhorvath / Pyrebase4

A simple python wrapper for the Firebase API. ⛺
254 stars 63 forks source link

Adding data to firebase #2

Closed sohilluhar closed 5 years ago

sohilluhar commented 5 years ago

Make sure these boxes are checked before submitting your issue:

[] Check that your version of Python is 3.4+ [] Check that you are on the newest version of Pyrebase [] Check that Email/password provider is enabled in your Firebase dashboard under Auth -> Sign In Method.

Please don't be discouraged if you do not get a response to your issue quickly, I maintain Pyrebase for fun and don't always have as much free time as I'd like.

Thank you for helping make Pyrebase better!

sohilluhar commented 5 years ago

when i am trying to to new data into my firebase databse

db.child("bookbuddybook").child(bookid).set(data)

this new data is not added to first it sort based on key then it is added. i want to add this on top of my data so how to do that?

nhorvath commented 5 years ago

I'm not clear on what you are asking, but the code you typed should add a new key with the value from bookid with data from data to the database bookbuddybook. You should make sure that the id in bookid is unique and doesn't exist yet. If you don't really care about the value of that ID you would be better off letting firebase autogenerate a unique key with

db.child("bookbuddybook").push(data)
nhorvath commented 5 years ago

Yeah, that's just how firebase works, but you can use order by in your application to sort them. db.child("bookbuddybook").order_by_key().get()

have you tried making the key numbers smaller alphabetically? They are probably sorted as a string, not as a number.

I'm going to close this issue though as it's not a bug and this isn't a firebase help forum.