title: Firebase realtime database read operation - Only get part of document returned possible?
body: <p><strong>I realise this question is marked as a duplicate - but I think this question is more comprehensive and easier to understand, and therefore more likely to help others. (^__^)</strong> </p>
  
  <p>I have read about reading data from Firebase realtime database. 
  <a href="https://firebase.google.com/docs/database/admin/retrieve-data" rel="nofollow noreferrer">https://firebase.google.com/docs/database/admin/retrieve-data</a></p>
  
  <p>What I have not found is any documentation on how to control what data gets returned from the read query. </p>
  
  <p>Consider the following structure:</p>
  
  <pre><code>-users
    -EiYu7OWooToo6noo
      alias: "Kermit"
      createdAt: 1538330532000
      firstName: "Kermit"
      surName: "Frogman" 
      pictureURL: "/imgs/kermit.png"
      phonePrimary: "555-1234"
      email: "kermit@themuppetshow.com"
      -myBooks
        -A1234567890
          title: "Frogs 101"
        ...
  </code></pre>
  
  <p>Is there a way to tell Firebase realtime database to only return some of the document data? </p>
  
  <p>This code returns the entire document:</p>
  
  <pre><code>var ref = db.ref(`users/${uid}`);
  
  ref.once("value", (snapshot) =&gt; {
    console.log(snapshot.val());
  }, function (errorObject) {
    console.log("The read failed: " + errorObject.code);
  });
  </code></pre>
  
  <p>Would it be possible to only get a partial document, for example: </p>
  
  <pre><code>    {
        alias: "Kermit"
        firstName: "Kermit"
      }
  </code></pre>
  
  <p>My reasoning is that this would be a huge performance gain when reading large amount of data. But is it possible?</p>