node做服务,在开发产环境中,将session数据放到的内存中了,上线的时候出现了,heap out of memory,于是就用了 connect-mongo 将 session存入了mongodb 中,最初是这样写的测试var dbUrl = 'mongodb://localhost/mysessions';mongoose.connect(dbUrl,{useMongoClient: true});var options = { url: dbUrl, collection: 'sessions'};app.use(session({ secret: '12345', name: 'test', cookie: {maxAge: 1 * 60 * 1000}, resave: false, saveUninitialized: true, store: new MongoStore(options)}));但是后来将 dburl改为了:var dbUrl = 'mongodb://jeremy:123456@localhost/mysessions';在启动服务时报错了:请问是什么原因,该怎么解决?
添加回答
举报
0/150
提交
取消