title: Undefined value when calling function in Firestore
body: <p>I'm using Firestore, and wrote the following code:</p>
  
  <pre><code>export function getAllServices(uid) {
    let services = [];
    firestore.collection('users').doc(uid).collection('services').get().then(snapshot =&gt; {
      snapshot.docs.forEach(doc =&gt; {
        services.push(doc.data());
        console.log(services);
        return services;
      })
    })
  }
  </code></pre>
  
  <p>The function works b/c console.log returns the array I want. However, when I call it like this </p>
  
  <pre><code>const uid = 'SgUaycgJqzLbdcrOhjQtgcDzddL2';
    const services = getAllServices(uid);
    console.log(services);
  </code></pre>
  
  <p>the console log always returns as undefined. Any ideas?</p>