Hi,
I am using this module for storing sessions in the database and now i am getting this error,
MongoError: E11000 duplicate key error collection: myDatabase.sessions index: _id_ dup key: { : "Lz4SJIHaBfGFfNg3_ChNTkFnwKBLQDUN" }
at Function.MongoError.create (/home/user/public_html/projectName/server/node_modules/mongodb-core/lib/error.js:31:11)
at toError (/home/user/public_html/projectName/server/node_modules/mongodb/lib/utils.js:139:22)
at /home/user/public_html/projectName/server/node_modules/mongodb/lib/collection.js:1060:67
at /home/user/public_html/projectName/server/node_modules/mongodb-core/lib/connection/pool.js:461:18
at _combinedTickCallback (internal/process/next_tick.js:73:7)
at process._tickDomainCallback (internal/process/next_tick.js:128:9)
I am using this module as,
app.use(session({
secret:appConfig.JWT_SECRET,
resave:false,
saveUninitialized:true,
store: sessionstore.createSessionStore({
type: 'mongodb',
host: 'localhost', // optional
port: 27017, // optional
dbName: 'databaseName', // optional
collectionName: 'sessions',// optional
timeout: 10000 // optional
}),
cookie: {
maxAge: 1000 * 60 * 60 // Milliseconds (3600000ms -> 60min)
}
}));
How to prevent creating documents with the same id. Also i am not using Mongoose in my project. What can be done as this does not crash the server but close down all the connections with the database and the users are not able to login (or there is no api response).
Hi,
I am using this module for storing sessions in the database and now i am getting this error,
I am using this module as,
How to prevent creating documents with the same id. Also i am not using Mongoose in my project. What can be done as this does not crash the server but close down all the connections with the database and the users are not able to login (or there is no api response).