CNode

上MongoStore 中db不能设置完整连接字符串,放在vps上连接不上mongodb

Yyakczh发布于13 年前最后回复13 年前1 回复5594 浏览0 收藏
    app.use(express.session({
        secret: settings.cookie_secret,
        store: new MongoStore({
          db: settings.db
        })
      }));

在本地测试,这个 settting.db设置成 数据库名字 比如test是可以通过的,但是放到vps,vps上的数据库一个完整的连接串,写完整了提示 

                                                          ^
Error: database names cannot contain the character '.'
查看回复

回复 (1)

Y
yakczh#1·13 年前

折腾了一上午 禁了MemoryStore就可以了 原来是vps不能用这货

Warning: connection.session() MemoryStore is not
designed for a production environment, as it will leak
memory, and will not scale past a single process.
Express server listening on port 8080
参与回复
登录后即可参与回复。登录