Skip to content
Advertisement

How to get firebase id

Anyone know how to get the Firebase unique id? I’ve tried name(), name, key, key(). Nothing works.

I am able to see the data but I have no idea how to get the id back. I need it.

JavaScript

Advertisement

Answer

The call to push will return a Firebase reference. If you are using the Firebase 3 API, you can obtain the unique key of the pushed data from the reference’s key property:

JavaScript

The key for the pushed data is generated on the client – using a timestamp and random data – and is available immediately.

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