title: How to get the referenced data from a Firebase Firestore reference?
body: <p>I have a web app that gets data from Firestore v9.  My instance of Firestore has a field of data type &quot;reference&quot;.</p>
  <p>When I query and get the reference object, I get the below when I console.log the result.</p>
  <p><a href="https://i.stack.imgur.com/kh7PV.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kh7PV.png" alt="screenshot" /></a></p>
  <pre class="lang-js prettyprint-override"><code>const ref = collection(firestoreDb, &quot;users&quot;, &quot;a_user&quot;, &quot;subscriptions&quot;)
  const firebaseResponse = await getDocs(ref)
  
  firebaseResponse.forEach(doc =&gt; {
      console.log(doc.data())
  })
  </code></pre>
  <p>The output doesn't have the string which I could then use to place into another <code>collection</code> or <code>doc</code> function.</p>
  <p>The field I'm using refers to this object:</p>
  <p><a href="https://i.stack.imgur.com/jhozW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/jhozW.png" alt="screenshot" /></a></p>
  <p>I expect the output to include price and product_name.</p>
  <p>I found some similar questions but there not exactly what I was looking for:</p>
  <ul>
  <li><a href="https://stackoverflow.com/q/46751459">How to query Firebase Firestore Reference data type?</a></li>
  <li><a href="https://stackoverflow.com/a/58300047">https://stackoverflow.com/a/58300047</a></li>
  <li><a href="https://stackoverflow.com/a/54310245">https://stackoverflow.com/a/54310245</a></li>
  </ul>