13

By now (10.7.2016) express-session's github-page suggests two mongodb session stores:

  1. connect-mongo | A MongoDB-based session store - Github (775 Stars)
  2. connect-mongodb-session | Lightweight MongoDB-based session store built and maintained by MongoDB - Github (6 Stars)

Which one should i choose and what are the differences between the two of them? By popularity clearly connect-mongo wins, but is it really the "better" product? Why did MongoDB itself bother to programm connect-mongodb-session with an existing solution?

Any advice appriciated.

P.S.: I noted that there are several (outdated) SO questions comparing different MongoDB backed session stored but (as far as i notices) non compared these recommended two.

4

1 回答 1

23

Connect-mongo 已经存在了更长的时间,而 connect-mongodb-session 的设计目的是通过更加固执己见而更易于使用。Connect-mongo 有更多选项可以调整。

这两个库的维护者在https://github.com/mongodb-js/connect-mongodb-session/issues/15很好地讨论了它们的差异。tl; dr 两者都是稳定的。唯一的主要设计区别是 connect-mongodb-session 不认为 session 查询应该与 db 的其他客户端共享连接池,而 connect-mongo 认为应该。两位维护者都提出了很好的论据。

尽管它们看起来很稳定,但它们的提交数量都惊人地高。仔细观察会发现,大多数对 connect-mongodb-session 的提交只是一场持续的竞赛,以保持依赖项指向最新版本的驱动程序。

于 2015-12-28T07:52:04.250 回答