title: How to store a users UID in a firebase database and have it map to a POJO
body: <p>CONTEXT</p>
  
  <p>I am currently working on a Firebase application (in Android). I have set up authentication, storage and the database with no issues to speak of. As the Firebase auth user only has a few properties, I have created a "user" POJO to store additional user information that is not contained inside of the Firebase auth user (ie first name, date of birth, nationality, etc...). The structure of this is shown in the image below:</p>
  
  <p><img src="https://i.stack.imgur.com/H3Luj.png" alt="demo of structure"></p>
  
  <p>The UUID in the image is the users respective auth uid. This was achieved as such:</p>
  
  <pre><code>ref.child(users).child(auth.getUid()).setValue(user);
  </code></pre>
  
  <p>This approach seems in line with the documentation as it allows me restrict write/read to the account owner using the <code>auth.uid === $uid</code> rule. Furthermore, all of the properties inside of the tree map to my POJO as expected.</p>
  
  <p>PROBLEM</p>
  
  <p>My one big problem is that I want to store the users uid inside the POJO. As the UID is currently structured as the objects parent, I am not sure how to map it to the user POJO. I could of course store an additional field in the bottom tree level. However, that seems like pointless data redundancy.</p>
  
  <p>QUESTION</p>
  
  <p>What is the best way to map the uid to a respective "user" POJO class. Ideally I'd be able to fetch 10 users to display, and when one is tapped have the app load a profile activity. This would mean passing the uid of the user, so I can say:</p>
  
  <pre><code>ref.child(users).child(targetUID)
  </code></pre>
  
  <p>and fetch the tapped user account. This means having their uid.</p>