title: How to rename a user in MongoDB?
body: <p>There is a user in database, this user should be renamed. How to rename the user? The MongoDB user management reference has method <a href="https://docs.mongodb.org/v3.0/reference/method/db.updateUser/#db.updateUser" rel="noreferrer">db.updateUser</a> but I don't see how to set a new name for the user. <strong>How to update the username?</strong> ty</p>
  
  <pre><code>db.updateUser(
     "&lt;username&gt;",
     {
       customData : { &lt;any information&gt; },
       roles : [
                 { role: "&lt;role&gt;", db: "&lt;database&gt;" } | "&lt;role&gt;",
                 ...
               ],
       pwd: "&lt;cleartext password&gt;"
      },
      writeConcern: { &lt;write concern&gt; }
  )
  </code></pre>