我的问题在注释代码中的下面的函数中。
newUser = new User();
newUser.save(function(err){
if(err) console.log('error saving user');
// is my user saved at this point? Can I modify
// the user in here or is this pre-save?
});
最佳答案
代码一执行就会被保存。中间件中会发生一些验证,但否则是即时的。
关于javascript - 我的文档何时使用 Mongoose 保存功能保存?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35211566/