Editing a previously saved document also updates it in the db
<p>FYI, using Mongodb, Express, and Mongoose on node.js.</p>

<p>I'm saving a document (a user, that contains data) with <code>.save()</code>, and then I want to return this user on the request through the <code>.send()</code>.
However I certainly do not want to return its password, so I'm accessing the previously saved document and removing the password with the following:</p>

<pre><code>user.status = /* Create new status and assign */;
user.save();
user.password = undefined;
</code></pre>

<p>It should be noted that this is inside a couple of callbacks as such (pseudo-code):</p>

<pre><code>Users.findOne (
    // Do stuff
    user.token = /* New token */;
    user.save();

    Shops.findOne( /* search by userId */
        // Do stuff
        user._shopId = shopId;
        user.status = "active";
        user.save();

        // Hide password
        user.password = undefined;

        // Send
        res.send({success: true, user: user});
    )
)
</code></pre>

<p>I expected the database document for this user to remain the same, since I did not save it after editing it. And yes, if I don't <code>.save()</code>, I can change it at will (like using an update to update it and on its callback <code>.send()</code>).</p>

<p>However, the document's password gets removed. Is the <code>.save()</code> somehow asynchronous, or only runs at the end of the thread's life even though I put it at the middle of its code?</p>

<p>Thanks.</p>