Create new Javascript firebase node

0

Hello Good afternoon, you can help me with the following question:

I create a new node, but the parent node creates it to me randomly and I do not want it to be that way, I want to give it the name of the parent node.

That name is put alone, I want to define the name of that node.

    
asked by Javier 30.07.2018 в 17:53
source

1 answer

0

Those nodes with random keys are generated when you use the push() operation, this generates a unique ID within the node so you can use it as an identifier.

If what you want is to create nodes with your own id all you have to do is call set () to the address that includes the parent node / id you want to use.

Ex:

 firebase.database().ref('clientes/' + 1234).set({
    nombre: nameInput,
    email: emailInput,
    telefono : phoneInput
  });
    
answered by 01.08.2018 / 12:02
source