title: Using Firestore document's auto-generated ID versus using a custom ID
body: <p>I'm currently deciding on my Firestore data structure.</p>
  
  <p>I'll need a <code>products</code> collection, and the <code>products</code> items will live inside of it as documents.</p>
  
  <p>Here are my <strong>product's fields</strong>:</p>
  
  <ul>
  <li><strong>uniqueKey:</strong> string</li>
  <li><strong>description:</strong> array of strings</li>
  <li><strong>images:</strong> array of objects</li>
  <li><strong>price:</strong> number</li>
  </ul>
  
  <p><strong>QUESTION</strong></p>
  
  <p>Should I use Firestore auto-generated ID's to be the <code>ID</code> of my documents, or is it better to use my <code>uniqueKey</code> (which I'll query for in many occasions) as the document ID? Is there a best option between the 2?</p>
  
  <p>I imagine that if I use my <code>uniqueKey</code>, it will make my life easier when retrieving a single document, but I'll have to query for more than 1 product on many occasions too.</p>
  
  <p>Using my <code>uniqueKey</code> as <code>ID</code>:</p>
  
  <pre><code>db.collection("products").doc("myUniqueKey").get();
  </code></pre>
  
  <p>Using my Firestore auto-generated <code>ID</code>:</p>
  
  <pre><code>db.collection("products").where("uniqueKey", "==", "myUniqueKey").get();
  </code></pre>
  
  <p>Is this enough of a reason to go with my <code>uniqueKey</code> instead of the auto-generated one? Is there a rule of thumb here? What's the best practice in this case?</p>