title: how to read data from firebase with admin sdk in cloud functions with typescript
body: <p>I am trying to write a cloud function which will be triggered by http and I will send a date as input and based on that date I want to fetch the list of games in my firebase db.</p>
  
  <p>I am not sure how to fetch the data from the snapshot i am receiving from promise.</p>
  
  <p>Code: </p>
  
  <pre><code>enter code hereexport const checkGameResult = 
  functions.https.onRequest((request, response) =&gt; {
    const date:string = request.query.gameDate;
    console.log(date);
    admin.database().ref('activegames/'+date).once('value').then(result=&gt;{
      console.log('result: ');
      console.log(result);
      console.log('result[0]: '+result[0]);
      response.send(date);
    }).catch(error=&gt;{
      response.status(500).status(error);
    });
  });
  </code></pre>
  
  <p>DB stucture:
  <a href="https://i.stack.imgur.com/CmyT4.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CmyT4.jpg" alt="DB stucture:"></a></p>
  
  <p>Console output:
  <a href="https://i.stack.imgur.com/CB2U0.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CB2U0.jpg" alt="enter image description here"></a></p>
  
  <p>I am not sure how to fetch the data from the snapshot i am receiving from promise. Please advise.</p>