title: How to update the document ID in firebase firestore?
body: <p>in my firestore database, I've made the user's email as the document key. Do if I want I cal do <code>db.collection('users').doc('email_id')</code> to perform some action. Now the problem is when the user is updating their email id, I am not finding any way to update the <code>document id</code> in firestore.</p>
  
  <p>I've tried to do </p>
  
  <pre><code>db.collection('users').doc(old_email).update({
    id: new_email
  })
  </code></pre>
  
  <p>But that actually created a new field called <code>id</code> with the new email as value inside that document instead of updating the actual <code>document id</code> so that I can pass it within <code>doc()</code> and get the same data about the user.</p>
  
  <p>Does anyone know how to do it? If so, please do share. </p>
  
  <p>before posting this question I have checked google and firestore docs but didn't find any way to update the document id. Please help.</p>