Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望在没有密码的情况下发送结果。然后我做:
Delete req.session.user.password res.send(req.session.user)
密码仍然存在。为什么? 如何删除不想回复的属性?
在删除密码之前,您需要将您的 mongoose 用户模型对象转换为纯 JavaScript 对象。
var user = req.session.user.toObject(); delete user.password; res.send(user);