title: How to update document in firestore?
body: <p>I read some post how to update document in firebase but it doesn't work for me. User have possibility to add document in his database and he should have possibility to update that entry. Here is my code for now...</p>
  
  <pre><code>const form = document.querySelector('#database');
  
  form.addEventListener('submit', (e) =&gt; {
      e.preventDefault();
      db.collection('database').add({
          field1: form.field1.value,
          field2: form.field2.value 
      });
      db.collection('database').update({
          field2: form.field2.value
      });
  })
  </code></pre>