title: Mongoose password update using await
body: <pre class="lang-js prettyprint-override"><code>exports.reset = async function (req, res) {
    const _id = req.body._id;
    let hashed = await hash(&quot;123456&quot;);
    console.log(&quot;hashed&quot;, hashed); //hashed $2b$10$QgZqLrYNuaX64IFg5VFsC
    UserModel.updateOne(
      { _id: _id },
      { $set: { password: hashed } },
      (err, doc) =&gt; {
        if (err) {
          console.log(err);
        }
        console.log(&quot;doc:&quot;, doc.password); //doc: undefined ? why
        res.send({ msg: &quot;update sucess&quot;, code: &quot;1&quot; });
      }
    );
  };
  </code></pre>
  <p>Hi I am trying to reset password after hashing it by using await, but even the result is success and the hashed password appeared before <code>updateOne</code> but doc.password show &quot;undefined&quot;, and the password did update. Can anyone tell me what did I do wrong ?</p>