We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
文件位置:models/users.js
代码:
//使用middleware,每次保存都记录一下最后更新时间 User.pre('save', function(next){ this.updated = Date.now(); next(); });
问题: 不应该在 save 内更新 updated,save 只会在初始化当前 Model 的时候执行,update 的时候是不会执行的
The text was updated successfully, but these errors were encountered:
No branches or pull requests
文件位置:models/users.js
代码:
问题:
不应该在 save 内更新 updated,save 只会在初始化当前 Model 的时候执行,update 的时候是不会执行的
The text was updated successfully, but these errors were encountered: