I am getting this strange error on my Node.js server:
Error: Connection strategy not found at MongoStore (/Users/amills001c/WebstormProjects/lectal_all/manager/node_modules/connect-mongo/src/index.js:100:23) at Object.<anonymous> (/Users/amills001c/WebstormProjects/lectal_all/manager/app.js:42:12) at Module._compile (module.js:425:26)
We are using Passport with Express.
The error is happening at the line mongoose_connection: mongoose.connection in the following snippet:
app.use(expressSession({
    secret: 'foobar',
    cookie: {
        secure: false,
        maxage: 1160000000,
        resave: true,
        saveUninitialized: true
    },
    store: new MongoStore({
        mongoose_connection: mongoose.connection   /*<== error happens here*/
    })
}));
What is this error and how can I fix it?
According to docs, I believe that line should be:
store: new MongoStore({
    mongooseConnection: mongoose.connection
});
Use mongooseConnection instead of mongoose_connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With