admin管理员组文章数量:1356548
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._pile (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?
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._pile (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?
Share Improve this question edited Nov 29, 2016 at 19:57 Alexander Mills asked Dec 21, 2015 at 20:55 Alexander MillsAlexander Mills 100k166 gold badges537 silver badges916 bronze badges1 Answer
Reset to default 9According to docs, I believe that line should be:
store: new MongoStore({
mongooseConnection: mongoose.connection
});
Use mongooseConnection
instead of mongoose_connection
.
本文标签:
版权声明:本文标题:javascript - Passport.js and MongoStore error "Connection strategy not found at MongoStore" - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1743948956a2566929.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论