title: How do I update Firestore document value to opposite of current boolean?
body: <pre><code>db.collection('tasks').doc(taskID).get().then((doc) =&gt; {
      if (doc.exists) {
        console.log('document data: ', doc.data());
        doc.ref.update({
          completed: !doc.ref.completed,
        }).then(() =&gt; {
          console.log('completion stat update has been successful');
        }).catch(err =&gt; {
          console.log('Error updating completition status: ', err);
        });
      } else {
        console.log('no such document!');
      }
    }).catch(err =&gt; {
      console.log('Error getting document: ', err);
    });
  </code></pre>
  <p>When I run the above code, I always get 'completion stat update has been successful', however, the 'completed' boolean value is only ever changed from false to true, and if it starts out as true, doesn't switch back to false. Shouldn't the '!doc.ref.completed' part of the code handle that?</p>