MongoDB-backed session store for express-session. Current stable version is 1.0.0, released in 2025. It targets Node.js >=22 and supports both native MongoDB driver and Mongoose adapters. A modern rewrite of the original Express 2/Mongoose store, it provides ESM and CommonJS compatibility, TypeScript types, and a simple API. Key differentiators include a pluggable adapter pattern, automatic TTL index creation, and deprecated migration helpers for legacy code.
npm install express-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to set up a session store using native MongoDB driver with express-session.
Use new MongoSessionStore(options) or new MongooseSessionStore(options) directly with express-session.
Import MongoSessionStore or MongooseSessionStore from the package and instantiate with options.
Use 'collectionName' and 'clearIntervalSeconds' instead.
Call client.close() or mongoose.disconnect() after you no longer need the session store.
Import named export: import { MongoSessionStore } from 'express-mongodb'Run 'npm install express-mongodb' and ensure the import statement is correct.