我尝试使用nodejs的mongoose-encryption来加密新用户的密码,但我得到了错误
"C:\Users\user\OneDrive\old Desktop\web developer\WebDevelopment\Secrets - Starting Code\node_modules\mongoose-encrypt\lib\index.js:123
paths.forEach(function(path) {^
TypeError: Cannot read property 'forEach' of undefined"
字符串
这是加密的代码
const usersSchema = new mongoose.Schema({
email: String,
password: String
});
const secret = "Thisisourlittilesecret";
usersSchema.plugin(encrypt, { secret: secret, encryptedFields: ['password'] });
const User = mongoose.model("User", usersSchema);
型
1条答案
按热度按时间f1tvaqid1#
我也有同样的问题
原来我导入了'mongoose-encrypt'而不是'mongoose-encryption'