title: How can I delete a property from object returned by mongoose
body: <p>I am querying users collection and I don't want to send back password. My main point is that if I can perform javascript operations on mongodb objects or not. Here is my code:</p>
  
  <pre><code>router.get("/:userId", async (req, res) =&gt; {
    try {
      const user = await User.findById(req.params.userId);
      delete user.password;
      if (user.parent !== undefined) {
        const referrer = await User.findOne({ _id: user.parent });
        return res.json({ user, referrer });
      }
      res.json(user);
    } catch (error) {
      res.status(400).json(error);
    }
  });
  </code></pre>
  
  <p>I am getting this output</p>
  
  <pre><code>{
      "is_deleted": false,
      "packages": [],
      "_id": "5ed102f3fefa080404db01df",
      "name": "parent",
      "email": "parent@parent.com",
      "gender": "m",
      "password": "$2b$10$HTGaoy.AVmoG/A0c/vkikO0NnEBte7f2tvwt2FQE94bZlNiYTeX8i",
      "__v": 0
  }
  </code></pre>
  
  <p>I tried to perform filter on a list of mongodb objects and that failed too.</p>