0
我的問題是在下面的註釋代碼中的功能。我的文檔何時使用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?
});
它立即被保存,但'save'方法是異步的,因爲中間件調用本地代碼來執行保存 – adeneo
@chridam oops,在我的真實代碼中,我做了正確的 –