Search code examples
firebasefirebase-realtime-databasefirebase-console

Is there any way to create push ID manually in Firebase console?


In my java code I know how to create unique ID by calling push() method

DatabaseReference().child("list").push();

My question is:

Is there any way to do that manually in Firebase Realtime Database Console? I mean in a website?


Solution

  • No, you cannot create a push() id manually in the firebase console. You can manually add random numbers/letters in the console but that wont help you later on.

    You use the push() that generates a unique key for each new child thus preventing overriding data.

    Example:

    Users
      pushid_here
          name: userx
          age: 100
      pushid_here
          name: usery
          age: 121
    

    Then when you are querying you can use getKey() to get the push key and be able to access the data inside of it. That is why the firebaserecyclerview you said in the comments only works with push().

    for more info: https://firebase.google.com/docs/database/admin/save-data#getting-the-unique-key-generated-by-push