title: mongo-connect error with mongo-connect(session)
body: <p>After searching around about it, I can't find any solution or mistake in my <code>code</code> about this error. I've got my <code>app.js</code> files inside my node JS application with the <code>mongo-connect</code> declaration :</p>
  <pre><code>const MongoStore = require('connect-mongo')(session)
  </code></pre>
  <p>And I've got this error :</p>
  <blockquote>
  <p>TypeError: Class constructor MongoStore cannot be invoked without
  'new'
  at Object. (/Users/souhailmohamed/project/devops/story website/app.js:11:20)
  at Module._compile (internal/modules/cjs/loader.js:1063:30)
  at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
  at Module.load (internal/modules/cjs/loader.js:928:32)
  at Function.Module._load (internal/modules/cjs/loader.js:769:14)
  at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
  at internal/main/run_main_module.js:17:47</p>
  </blockquote>
  <p>There is my <code>app.use</code> code beloww :</p>
  <pre><code>app.use(session({
      secret: 'story book',
      resave: false,
      saveUninitialized: false,
      store: new MongoStore({ mongooseConnection: mongoose.connection })
  }))
  </code></pre>
  <p>I understand pretty well about the</p>
  <pre><code>const MongoStore = require('connect-mongo')(session)
  </code></pre>
  <p>but I didn't understand the error. But it's from a tutorial from youtube by traversy media <a href="https://www.youtube.com/watch?v=SBvmnHTQIPY&amp;t=4202s&amp;ab_channel=TraversyMedia" rel="noreferrer">LinK</a></p>