title: How to get document after set method in firestore while updating
body: <p>I am making an update to my document. I use the set method because I want to overwrite my fields. Therefore, when i do my set, it works perfectly, modifying the object in the firestore database. But i am not able to return the document afterward. The error I get:</p>
  
  <pre><code>Cannot read property 'exists' of undefined
      at Firebase.js:127
  </code></pre>
  
  <p>Here is my code:</p>
  
  <pre><code>const updateItemFromCollection = async (collectionName, uid, data) =&gt; {
    return database
      .collection(collectionName)
      .doc(uid)
      .set(data, { merge: true })
      .then(doc =&gt; {
        if (!doc.exists) {
          console.log("No such document!"); //Error
        } else {
          return doc.data();
        }
      })
      .catch(error =&gt; {
        console.log(error);
      });
  };
  </code></pre>