title: Firestore - Query, then update
body: <p>I want to return an item with a specific ID and perform an update operation on it. My query gets the right result, but it won't let me update it.</p>
  
  <p>I tried following this tutorial: <a href="https://www.youtube.com/watch?v=mYyPbfpoZeM" rel="noreferrer">https://www.youtube.com/watch?v=mYyPbfpoZeM</a>
  And read the documentation. Both didn't help. Other threads to the same topic are, well, different.</p>
  
  <p>I have a database of objects which have a unique ID stored as integer.
  I have an HTML form to get an ID as user input and the query below to retrieve the according object.</p>
  
  <p>I tried this. The query worked, the update didn't.</p>
  
  <pre><code>db.collection('objects').where('ID','==', ID ).get().then((snapshot) =&gt; {
          snapshot.docs.forEach( doc =&gt; {
              console.log('debug');
              console.log(doc.data().ID);
          })
      });
  </code></pre>
  
  <p>I am still new to firebase and js, so please forgive me if my code is uterly wrong.
  I am currently stuck with this:</p>
  
  <pre><code>db.collection('objects').where('ID','==', ID ).get().then((doc) =&gt; {
      console.table(doc);
  });
  </code></pre>
  
  <p>Which is still not working.</p>
  
  <p>For the second snippet an I currently get an unlegible table in which I can't really find the object I was looking for.</p>
  
  <p>How do I update a single value in a single document?</p>
  
  <p>EDIT: I forgot my implementation  attempts of the update function.
  I tried <code>doc.update({value:0})</code> inside the for loop in snippet one which yielded <code>doc.update is not a function</code>. Similarly for <code>doc.data().update(...)</code>.</p>
  
  <p>In the second snippet I mainly tried to see what I got returned and ran variations of the above mentioned uodate function. With no success.</p>