Reputation: 21507
By now (10.7.2016) express-session's github-page suggests two mongodb session stores:
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.
Upvotes: 15
Views: 4149
Reputation: 1886
Connect-mongo has been around for much longer, while connect-mongodb-session was designed to be easier to use by being more opinionated. Connect-mongo has many more options to tweak.
The maintainers of the two libraries have a good discussion of their differences at https://github.com/mongodb-js/connect-mongodb-session/issues/15. The tl;dr is that both are stable. The only major design difference is that connect-mongodb-session does not believe that session queries should share the connection pool with other clients of the db, while connect-mongo believes they should. Both maintainers present good arguments.
Despite their apparent stability, both have surprisingly high numbers of commits. A closer look shows that most of the commits to connect-mongodb-session have just been an ongoing race to keep the dependency pointing to the latest versions of the drivers.
Upvotes: 26