title: How to get a value from Firebase Database and assign it to a value in Firebase Cloud Functions?
body: <p>So I'm using firebase as a backend to a demo app, and I like the stack quite a bit, but I'm hung up on one issue, I can't figure out how to retrieve values from the database (I've got keys just fine). <br>
  Simply put, I'm sending information from one device that contains the "friendly-name" of another device it is trying to reach to a firebase function.
  The function code looks like this:</p>
  
  <pre><code>exports.connectMe = functions.https.onRequest((req, res) =&gt; {
      cors(req, res, () =&gt; {
      admin.database().ref('calls/' + req.body.id + '/').set({
          target: req.body.target,
          caller: req.body.caller,
          time: req.body.time
      });
  
      const target = req.body.target;
      console.log(`target: ${target}`);
      const targetCall = admin.database().ref(`tokens/${target}/token`);
      console.log(targetCall);
      // const targetValue = targetCall.val();
      res.status(200).send("Thanks For The Call!");
      });    
  });
  </code></pre>
  
  <p>The variable, targetCall is correctly pointed at the db entry that I want to reach, but I cannot extract the value for the life of me. The token located at <code>admin.database.ref</code> is required to be placed in a http request. How do I get the value? The commented out code shows the variable I would want to store it in, but I know that .val() is not a method of reference.<br> For the record, <code>admin</code> is set to <code>require('firebase-admin');</code> earlier in the code.</p>