title: Unable to access nested collection firestore
body: <p>I am trying to build an application in Node and Express. I am able to fetch all the data and get specific document properties. However,I am unable to do 2 things:</p>
  <ol>
  <li>Make the async method return data as an array so that I could use it instead if having to make multiple calls.</li>
  <li>Get values from the collections within each individual document.</li>
  </ol>
  <p>Please help me out guys. Below is how I am currently referencing the nested collection.</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const fetchAllGoals = async (req, res, next) =&gt; {
    /**
     * Sends a request to Firestore for a specific user's goal collection data.
     * This is accomplished by reading req.params.uid which is value passed after the /
     * All goals are pushed to the goalsArray
     * I then return the data as an api response.
     */
    try {
      let id = req.params.uid;
      const goals = await firestore.collection(
        "users/" + req.params.uid + "/goals"
      );
      const data = await goals.get();
      const goalsArray = [];
      data.forEach((doc) =&gt; {
        const goal = doc.data();
        console.log(goal);
  
        goalsArray.push(goal);
      });
      res.json({ data: goalsArray });
    } catch (error) {
      res.status(400).send(error.message);
    }
  };</code></pre>
  </div>
  </div>
  </p>