title: Best way to add data to a list in firebase database
body: <p>I am using Firebase realtime database and was trying to store a list of &quot;Animales&quot; for a user.</p>
  <p>Database structure:</p>
  <p><img src="https://i.stack.imgur.com/YdZfh.png" alt="Database structure link" /></p>
  <p>What I want to achieve is that for example: for the user with &quot;Uuid&quot; 11111 a list with the animals that he is publishing appears. I mean:</p>
  <pre><code>Fireabase-root
      |
      --- 11111
            |
            --- animal1 
                  |
                  --- descripcion: &quot;algo&quot;
                  |
                  --- edad: &quot;algo&quot;
                  |
                  --- nombre: &quot;algo&quot;
                  |
                  --- raza: &quot;algo&quot;
  
             --- animal2
                 ...
             --- animal3
                 ...
  </code></pre>
  <p>I wanted to know what is the best way to do this. I thought that the child &quot;animal1&quot; is a key and for each animal that is generated a different key is added, but I don't know if this is the best way to solve it. I tried to try with the push method that I saw that generates a key, but I don't know how to use it. I leave what I was testing.</p>
  <pre><code>DatabaseReference nombre = FirebaseDatabase.getInstance().getReference().child(&quot;Users&quot;).child(&quot;Animales&quot;).child(userId).push().child(&quot;nombre&quot;);
  nombre.setValue(&quot;Leon&quot;);
  </code></pre>