这段简单的代码说明了问题:第二个会话没有保存。我怎样才能使这项工作?
router.post('/users/login', function (req, res) {
var db = req.usersDb;
var users = db.get('users');
req.session.test = "This works";
req.session.save();
users.findOne({ username: req.body.username}).on('success', function (doc) {
console.log(doc.email); //this works
req.session.email = doc.email; //This not working
req.session.save();
});
});