简体   繁体   English

Express.js和connect-mongo会话“ TypeError:无法读取未定义的属性'upserted'”

[英]Express.js and connect-mongo session “TypeError: Cannot read property 'upserted' of undefined”

I am trying to store sessions using connect-mongo module, however I get the following Error: 我正在尝试使用connect-mongo模块存储会话,但是出现以下错误:

TypeError: Cannot read property 'upserted' of undefined

The usage of connect-mongo looks as follows: connect-mongo的用法如下所示:

import session from 'express-session';
const MongoStore = require('connect-mongo')(session);

app.use(session({
  secret: 'SECRET',
  store: new MongoStore({ url: 'mongodb://mongo:27017/sessions' }),
  saveUninitialized: true,
  resave: false
}));

At the same time, I can see that session entries are being created on every page reload with the following contents: 同时,我可以看到在重新加载的每个页面上都在创建会话条目,其中包含以下内容:

{
  "_id": "zO68C8OuARTUblw3EqHfUikR_IIHRaQq",
  "session": "{\"cookie\": \"originalMaxAge\":null,\"expires\":null,\"httpOnly\":true,\"path\":\"/\"    }}",
  "expires": new Date(1470779765287)
}

And the expiration date is set to 14 days from the creation timestamp (default value) 并将到期日期设置为自创建时间戳记起的14天(默认值)

Package versions used: 使用的软件包版本:

"cookie-parser": "^1.4.3",
"connect-mongo": "^1.3.1",
"express": "~4.0.0",
"express-session": "^1.14.0",

我在connect-mongo信息库上打开了一个问题 ,确实,该问题已在最新版本1.3.2中解决:)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Connect-mongo在常量错误中更新结果:TypeError:无法读取未定义的属性“Store” - Connect-mongo Update Results In Constant Error: TypeError: Cannot read property 'Store' of undefined Express.js猫鼬:TypeError无法设置未定义的属性 - Express.js mongoose: TypeError Cannot set property of undefined Express.js 无法读取未定义的属性“req” - Express.js Cannot read property 'req' of undefined Sequelize.js/Node.js/Express.js:Tasks.findAll() 返回一个 TypeError:Cannot read property 'findAll' of undefined - Sequelize.js/Node.js/Express.js: Tasks.findAll()returns a TypeError:Cannot read property 'findAll' of undefined Node.JS / Express / Mongo:TypeError:无法读取未定义的属性“位置” - Node.JS/Express/Mongo: TypeError: Cannot read property 'location' of undefined 类型错误:无法读取未定义的属性“forEach”(节点 js、stripe、express) - TypeError: Cannot read property 'forEach' of undefined (node js, stripe, express) express.js 中缺少“/”字符 HTTP.get() 请求返回 TypeError:无法读取未定义的属性(读取“0”) - lack of "/" character in express.js HTTP .get() request returning TypeError: Cannot read properties of undefined (reading '0') node.js、express.js 和 mysql - 无法读取未定义的属性“状态” - node.js, express.js, and mysql - Cannot read property 'status' of undefined Express TypeError:无法读取未定义的属性“ get” - Express TypeError: Cannot read property 'get' of undefined 类型错误:无法读取 Express 上未定义的属性“get” - TypeError: Cannot read property 'get' of undefined on Express
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM