Best Session Storage Middleware for Express + MongoDB

22,751

Solution 1

connect-mongo (https://github.com/kcbanner/connect-mongo) looks better then others.

express-session-mongo and connect-session-mongo are very old and based on old version of mongodb driver.

session-mongoose based on mongoose, that slower than mongodb driver.

I think connect-mongo is the best choose.

Solution 2


connect-mongodb-session

  • https://www.npmjs.com/package/connect-mongodb-session
  • Published 3 months ago
  • connect-mongodb-session: MongoDB-backed session storage for connect and Express. Meant to be a well-maintained and fully-featured replacement for modules like connect-mongo
  • Google also now shows this one first.

connect-mongo


Share:
22,751
Crisboot
Author by

Crisboot

Crazy developer :D

Updated on November 13, 2020

Comments

  • Crisboot
    Crisboot over 3 years

    I was looking for the best middleware for storing session data in MongoDB to use in a production application that uses express?

    I've been looking around and found this:

    1. session-mongoose (https://github.com/donpark/session-mongoose) According to author's comment this is not production-ready for following reasons:

      • insufficient testing
      • zero optimization
      • there are better options than MongoDB for session storage
    2. connect-mongo (https://github.com/kcbanner/connect-mongo)

    3. express-session-mongo (https://github.com/davglass/express-session-mongo)

      Based on these classes

      • Sencha Connect Memory Store
      • ciaranj's express-session-mongodb
    4. connect-session-mongo (https://github.com/bartt/connect-session-mongo)

    I've been looking at their code, I was trying to find also a performance comparisson article. Do you guys have experience to suggest which is the best?

  • Anonymous Creator
    Anonymous Creator over 2 years
    Now these both packages are seems to be updated ones. I am using connect-mongo as I had referred one project for that. But in case of mongodb is not available it is failing. Is there any mechanism to retry in connect-mongo? I have posted question below, but unable to find any solution so far. stackoverflow.com/questions/70410326/…