-
Notifications
You must be signed in to change notification settings - Fork 342
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongoStore.create({}) options 'client' and 'clientPromise' not compatible with Mongoose version 6 #436
Comments
Can you provide any information that this is a bug in |
This will probably be solved with my PR that I'm trying to finish out |
Hi. Any update? Everyone I know uses mongoose for MongoDB and when I do |
4.6.0 released |
It's still happening for me on 4.6.0
|
This example demonstrates how it's done with Mongoose 6 https://github.com/jdesboeufs/connect-mongo/blob/master/example/mongoose.js . Though I prefer a bit simpler approach (one that's also closer to what was there with previous versions): ...
store: MongoStore.create({
client: mongoose.connection.getClient(),
... |
this works for me const MongoStore = require('connect-mongo'); =================Main Code============================= const store = MongoStore.create({
mongoUrl: dbUrl,
secret: 'thisshouldbeabettersecret',
touchAfter: 24 * 60 * 60
}) ================= End Main Code============================= store.on('error', function(e){
console.log('Session Store Error', e)
})
const sessionConfig = {
store,
// change your default name
name: 'session',
secret: 'thisshouldbeabettersecret!',
resave: false,
saveUninitialized: true,
cookie:{
httpOnly: true,
// don't use this on development it's break thing
// secure: true,
expires: Date.now() + 1000 * 60 * 60 * 24 * 7,
maxAge: 1000 * 60 * 60 * 24 * 7
}
}
app.use(session(sessionConfig)) |
@vishwajeetsinh-arham , your code (the |
Please using for mongo-store options { client : mongoose.connection.getClient() ) |
I'm submitting a ...
[x] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[ ] question about how to use this project
Summary
Mongoose has been updated to version 6. When using
client
orclientPromise
inMongoStore.create({ })
, sessions are no longer saved to database.Other information (e.g. detailed explanation, stack traces, related issues, suggestions how to fix, links for us to have context, eg. StackOverflow, personal fork, etc.)
The text was updated successfully, but these errors were encountered: