当使用connect-session-sequelize时,我定义了一个extendDefaultFields方法,如下所示 ```
function extendDefaultFields(defaults, session) {
return {
userId: session.UserInfo.UserID,
test: 'abc'
};
}
``` SequelizeStore的配置如下
const options = { db: sequelize, table: SessionsModel, extendDefaultFields: extendDefaultFields };
const sessionStore = new SequelizeStore(options);
该表的定义如下
const Sessions = sequelize.define('Sessions', {
sid: Sequelize.STRING,
userId: Sequelize.STRING,
expires: Sequelize.DATE,
data: Sequelize.STRING(50000),
test: Sequelize.STRING
});
问题是除数据,sid,过期外,数据库中的其他字段无法保存。 UserId和测试字段均为空 谢谢答案