Questions tagged [connect-mongo]
100 questions
1
vote
1 answer
how do I can generate sessions in server for logged in users only , with Express, Express-session, Passport and Connect-mongo?
I'm using express-session, passport, connect-mongo and mongodb-atlas last versions, for create sessions and save them on the server, the
problem is when app.use(passport.session()), this session is created even if the user is not logged…

Juan Manuel
- 35
- 6
1
vote
1 answer
Express Session - Configure Session Timeout and Lifetime
I'm currently migrating an Express single sign on application to a new identity provider. This new IdP requires the following session standards.
Session timeout: 1 hour
Session lifetime: 3 hours
If I'm interpreting this correctly the session…

jonathan
- 43
- 6
1
vote
3 answers
connect-mongo causing MongoError: E11000 duplicate key error collection
I'm using connect-mongo to store session.
Sometimes I'm getting :
MongoError: E11000 duplicate key error collection
I have a relatively large site that uses mongoDB with replications.
I tried to clear the session document and this appear…

Elad Vider
- 49
- 5
1
vote
1 answer
connect-mongo: why can't I write to the 'sessions' collection?
I am using connect-mongo with express-session, and the session data is being written to Mongo as expected.
However, I would like to reuse the sessions collection that connect-mongo uses to write my own fields in that collection on top.
I have…

alexcs
- 480
- 5
- 16
1
vote
0 answers
Sharing session between express apps (connect-mongodb)
so my end goal is to have multiple node apps that connect to the same database and share sessions among users. So if you log out of one app it logs you out of all of them and same goes for logging in. So this IS WORKING in my dev environment. I have…

Sam Munroe
- 1,266
- 2
- 20
- 41
1
vote
1 answer
Express session won't persist, even with MongoStore using connect-mongo
When I restart my server, my session ends and I am logged out. This does not happen on a regular page refresh. I am using connect-mongo to remedy this:
var session = require('express-session');
const MongoStore =…

Max Pekarsky
- 590
- 2
- 6
- 20
1
vote
1 answer
Express-session and tokens in one project
I need explanation in express-session and jwt. E.g. I have shopping cart, and to log in and sign in I use jwt but to store chosen products in shopping cart I would like use express- session and connect-mongo Is that correct way? And my question is…

Mat.Now
- 1,715
- 3
- 16
- 31
1
vote
1 answer
Updating express-session sessions
So what I'm trying to do is when the users accesses the page it will fetch their user profile from the mongodb database and then update the users session with the users profile.
Right now I'm currently using the following packages for sessions:
-…

Shous1962
- 11
- 2
1
vote
1 answer
MongoError: not authorized on (DB name) to execute command
I'm using Node.Js, Expressjs, mLab (to host my database) and mongoDB
Im getting an error of not being Authorized on Streetinform(my DB name) to execute command. {listIndexes: "sessions", cursor: {}}
this is the error.
this is how I connect to my…

Sean Reyes
- 1,636
- 11
- 19
1
vote
1 answer
Failed to use an existing native mongo-db connection in connect-mongo session store
index.js:
..
var MongoStore = require( 'connect-mongo' )( session );
var db = require( path.join( __dirname, 'db.js' ) );
..
db.connect( conStr, function( err ) {
if( err ) {
console.log( 'Connect to mongoDb failed!' );
…

mr_rozgo
- 11
- 3
1
vote
3 answers
Logging in to one Express app destroys session in other (same server)
I have two separate Express 4.x apps running on the same server machine (different ports), sharing a MongoDB instance. They both use different databases and have different session secrets.
I am able to log into application A or B individually…

Erik
- 12,730
- 5
- 36
- 42
1
vote
0 answers
Node.js - Express Session, Connect Mongo, and MongoDB
I have a have several mongo databases for separate parts of a website I am making. One of those databases is for sessions. I am using Connect Mongo to store the sessions in the databases. I can't seem to store in to session a ObjectId that…

Joshua Sicz
- 11
- 2
1
vote
1 answer
How to access Express(js)-session cookie serverside before responding?
Using a combination of Express-session, Connect-mongo and PassportJS on a Node server I have the following validation function:
expressApp.post('/login', function(req, res, next) {
passport.authenticate('login', function(err, user, info) {
…

Wollan
- 929
- 1
- 13
- 23
1
vote
1 answer
Manually deleting connect-mongo session by _id cast error
I'm attempting to manually delete a document from the connect-mongo sessions collection. When I try to delete a document I get the following error:
message: 'Cast to ObjectId failed for value "gl9-V-bjAjqv2Nwdf9vHPLN_Fnnl4Thz" at path…

Larry Hipp
- 6,205
- 3
- 26
- 31
1
vote
1 answer
callback not working in connect-mongo
i have used connect-mongo as session store .
connect-mongo@0.4.0.
my code is
app.use(express.session({
store: new MongoStore({
url: 'mongodb://192.168.1.124:27017/ip_session',
}, function(e) {
// Start the app by listening…

Rahul Thakkar
- 43
- 5