Get firebase auto-generated ID via msg.payload

#1

Hi there,

I've worked with Firebase as my database and user authentication. For my project, it's necessary to use the auto-generated ID from firebase.

image

I've tried with no success to get the id via msg.payload.

image

How can I get this value dynamically?
Any of these commands have worked: msg.payload.id, msg.payload.name, msg.payload[0], , msg.payload[1].

The only way it works is if I use something like: msg.payload["-Lbbm6AVDzjcHbx1cyZT"]. However, it's not a dynamic approach.

In a nutshell, I just need to get this value "-Lbbm6AVDzjcHbx1cyZT" and use it afterwards.

Thanks,
Helio

0 Likes

#2

see https://stackoverflow.com/questions/4260308/getting-the-objects-property-name

0 Likes