title: firestore array-like data structure indexing limitation
body: <p>In the firestore documentation, there is a description below</p>
  
  <blockquote>
    <p>Indexing limits - A single document can have only 20,000 properties in
    order to use Cloud Firestore built-in indexes. If your array-like data
    structure grows to tens of thousands of members, you may run into this
    limit.</p>
  </blockquote>
  
  <p><a href="https://cloud.google.com/firestore/docs/solutions/arrays" rel="nofollow noreferrer">https://cloud.google.com/firestore/docs/solutions/arrays</a></p>
  
  <p>I want to know how I can interpret the description.
  Which of two patterns meet the limitation?</p>
  
  <pre><code>&lt;pattern 1: categories in one document above 20,000&gt; 
      doc1
       - id:111  
       - categories: {aaaa:true, aaab:false, aaac:true, aaad: false, aaae:true, aaaf:true, aaag:true, aaah:true, aaai:true, aaaj:true, ,,,,,,,,,,, }
  </code></pre>
  
  <p>another pattern</p>
  
  <pre><code>&lt;pattern 2:  categories in one document is a few but as a collection of document number of categories above 20,000&gt; 
      doc_1
      - id:111
      categories{aaaa:true, aaab:false, aaac:true, only several element}
      doc_2
      - id:111
      categories{aaad:true, aaae:false, aaaf:true, only several element}
      doc_3
      - id:111
      categories{aaag:true, aaah:false, aaai:true, only several element}
  </code></pre>
  
  <p>I believe that pattern 1 reach the limit, but is pattern 2 reach the limit?</p>