我正在使用Mongoose库通过node.js访问MongoDB
有没有办法从文档中删除密钥?即不只是将值设置为null,而是将其删除?
User.findOne({}, function(err, user){
//correctly sets the key to null... but it's still present in the document
user.key_to_delete = null;
// doesn't seem to have any effect
delete user.key_to_delete;
user.save();
});