FireStore create a document if not exist : <p>I want to update a doc like this:</p>

<pre><code>db.collection('users').doc(user_id).update({foo:'bar'})
</code></pre>

<p>However, if the doc user_id does not exists, the above code will throw an error.
Hence, how to tell Firestore to create the student if not exists, in other word, behave like this:</p>

<pre><code>db.collection('users').doc(user_id).set({foo:'bar'})
</code></pre>
