title: Firestore: Get subcollection of document found with where
body: <p>I am trying to get the documents inside an subcollection which is part of an document found with the .where function</p>
  <p>Example:</p>
  <ul>
  <li>RootColl/</li>
  <li>Doc A/
  <ul>
  <li>SubColl 1
  <ul>
  <li>Doc 1</li>
  <li>Doc 2</li>
  <li>Doc 3</li>
  </ul>
  </li>
  <li>SubColl 2
  <ul>
  <li>Docs</li>
  </ul>
  </li>
  </ul>
  </li>
  <li>Doc A/
  <ul>
  <li>SubColl 1
  <ul>
  <li>Doc 1</li>
  <li>Doc 2</li>
  <li>Doc 3</li>
  </ul>
  </li>
  <li>SubColl 2
  <ul>
  <li>Docs</li>
  </ul>
  </li>
  </ul>
  </li>
  </ul>
  <p>I want to get all the documents under <code>SubColl 1</code> from the doc with the field level == 1</p>
  <p>I am trying to do it like:</p>
  <pre><code>db.collection(&quot;RootColl&quot;).where(&quot;field&quot;, &quot;==&quot;, &quot;1&quot;).collection(&quot;SubColl 1&quot;).get()
  </code></pre>
  <p>But by doing that I get the error</p>
  <blockquote>
  <p>Uncaught TypeError: db.collection(...).where(...).collection is not a function</p>
  </blockquote>
  <p><strong>EDIT 1:</strong>
  By following Frank van Puffelen suggestion, i get the same error, &quot;collection&quot; is not a function</p>
  <ul>
  <li><a href="https://i.stack.imgur.com/VtyNM.png" rel="nofollow noreferrer">Current Code</a></li>
  <li><a href="https://i.stack.imgur.com/92MBB.png" rel="nofollow noreferrer">Error</a></li>
  </ul>