我正在使用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();
});