title: How to retrieve data from a Firebase database with Kotlin?
body: <p>This is the model I upload on Firebase:</p>
  
  <pre><code>public class OnlineMatch{
  
  private User user1;
  private User user2;
  
  public OnlineMatch(User firstPlayer, User secondPlayer) {
          this.user1 = firstPlayer;
          this.user2 = secondPlayer;
      }
  
  }
  </code></pre>
  
  <p>Then I send data to Firebase in this way (kotlin):</p>
  
  <pre><code> fun createMatch(match: OnlineMatch) {
          val matchList = database.child("multiplayer").push()
          matchList.setValue(match)
      }
  </code></pre>
  
  <p>Thus, my DB structure is the following:</p>
  
  <p><a href="https://i.stack.imgur.com/aUFiO.png" rel="noreferrer"><img src="https://i.stack.imgur.com/aUFiO.png" alt="enter image description here"></a>
  If I expand a node I can see perfectly my objects: OnlineMatch(User1, User2)</p>
  
  <p><strong>Now I would like to query the db and obtain an ArrayList'&lt;'OnlineMatch'>'.</strong>
  I have already found the Firebase docs but I found nothing useful.
  How can I do? Thanks in advance.</p>