我的文件何时使用Mongoose保存功能保存?

时间:2016-02-04 21:02:31

标签: javascript mongodb mongoose

我的问题在于评论代码中的以下功能。

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?
            });

1 个答案:

答案 0 :(得分:1)

代码一执行就会保存。中间件中存在一些验证,但它是即时的。

相关问题