Created
April 13, 2011 12:06
-
-
Save lukemurray/917423 to your computer and use it in GitHub Desktop.
simple saving
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
user.save(function(err) { | |
if (err) | |
return saveFailed(); | |
req.flash('info', 'Your account has been created'); | |
req.session.user_id = user.id; | |
res.redirect('/'); | |
}); | |
I even get message in mongod | |
Wed Apr 13 21:39:13 [initandlisten] connection accepted from 127.0.0.1:51075 #26 | |
Wed Apr 13 21:39:13 [conn26] building new index on { email: 1 } for testapp.users | |
Wed Apr 13 21:39:38 [conn24] end connection 127.0.0.1:51038 | |
When I try to find it I use the follow and always get no found | |
User.findById(req.session.user_id, function(user) { | |
if (user) { | |
console.log('found'); | |
} | |
else { | |
console.log('not found'); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment