Skip to content
Advertisement

save unique key firebase to child

I have a database like this

JavaScript

I want to save a unique key “-MCzU6r-JqvAkC9unjru” in my child, like this

JavaScript

can I do that? if can how I can implement it in my code?

here code for add data to firebase

JavaScript

Advertisement

Answer

You can do the following:

JavaScript

Using getKey() you can retrieve the random id created using push() and then add it to the hashMap

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement