上MongoStore 中db不能设置完整连接字符串,放在vps上连接不上mongodb
发布于 11 年前 作者 yakczh 5094 次浏览 最后一次编辑是 8 年前
    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 回复

折腾了一上午 禁了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
回到顶部