Questions tagged [connect-mongo]
89 questions
11
votes
4 answers
Error: Connection strategy not found MongoDB
here is a simple connection to use express session store, it keeps banging out this error even though the text is right from the book. I am pretty sure is has something to do with 'new MongoStore' object initialization.
var express =…
![](../../users/profiles/1237532.webp)
Spencer Hire
- 703
- 3
- 13
- 25
3
votes
2 answers
Error: Cannot init client | mongo-connect express-session
I am getting error while trying to save session on mongodb. Here is my code..
const express = require("express");
const session = require("express-session");
const MongoStore = require("connect-mongo").default;
const app = express();
let…
![](../../users/profiles/9851854.webp)
Irfan Habib
- 35
- 3
2
votes
0 answers
mongoose: How can you access session model?
I use express-session package to handle sessions in express. I store sessions in mongodb using mongoose and connect-mongo for express-session store.
I am trying to delete some items from my collection when session that was created by express-session…
![](../../users/profiles/9333236.webp)
Константин Мешавкин
- 189
- 1
- 1
- 10
2
votes
0 answers
How to handle all error using connect-mongo in expressjs
I am using below code for session management but not able to catch errors like: mongo authentication error. However, I am using error middle ware as well.
var express = require('express');
var session = require('express-session');
var MongoStore =…
![](../../users/profiles/4758368.webp)
Sonu Singh
- 181
- 7
2
votes
1 answer
Express Session and Amazon Beanstalk with health check
I have a problem with express session, connect-mongo and Amazon Beanstalk.
Each time that Amazon Beanstalk wants to check health, It's doing a request to API but it creates a new document in mongodb database.
So, in a short time Amazon creates…
![](../../users/profiles/1741027.webp)
slorenzo
- 3,386
- 2
- 27
- 44
2
votes
3 answers
connect-mongo creating new session every second
I have my nodejs app hosted on Openshift. Here are my specs:
node v0.10.35, express v3.4.8
My package.json dependencies:
"dependencies": {
"angular-loading-bar": "^0.9.0",
"async": "^2.0.0-rc.5",
"bcrypt-nodejs": "0.0.3",
"body-parser":…
![](../../users/profiles/2529191.webp)
thethakuri
- 471
- 4
- 13
2
votes
1 answer
Node-gyp Connect-mongo on Amazon AWS EC2 Linux
I can't get connect-mongo to install on my EC2 instance. Has to do with node-gyp not having access to "/root/.node-gyp/0.10.40" - which is stange because the installed Node version is 4.2.1.
The folder "/root/.node-gyp/" doesn't even exit on the…
![](../../users/profiles/1365028.webp)
ChrisRich
- 6,698
- 9
- 37
- 56
2
votes
1 answer
Mongoose - Searching Schema via findOne() unsuccessfully
In setting up a sessionStore via MongoDB for express-session, I'm having a little trouble using the findOne() function to verify that a user's information is valid and recent.
var session = require('express-session');
var mongoStore =…
![](../../users/profiles/1861357.webp)
Signus
- 1,056
- 13
- 41
2
votes
0 answers
Connect-mongo: why is lazy session update not the default?
I'm developing an Express website that uses MongoDB as a backend and the connect-mongo middleware for sessions. Monitoring has shown that about 25% of the database time of my server is spent sending (mostly useless) updates to the MongoDB session…
![](../../users/profiles/2875803.webp)
Valentin Waeselynck
- 5,613
- 22
- 40
2
votes
1 answer
Handle database error when using connect-mongo
I've got a fairly standard connect-mongo setup
mongoose is initialised / connected prior to this
app.use(express.session({
secret: "sfdgsdgsdfg",
store: new MongoSessionStore({db: mongoose.connection.db})
}));
This works fine.
However…
![](../../users/profiles/131809.webp)
Alex
- 34,123
- 47
- 189
- 315
1
vote
0 answers
Connect-mongo package with Jest leads to error "Jest did not exit one second after the test run has completed"
I built a middleware for session-based authentication with express-session package and as a session store I use the connect-mongo package.
When I run this Jest test:
//..
const createServer = require("./server") // <-- this line triggers the…
![](../../users/profiles/2166778.webp)
elMeroMero
- 477
- 3
- 15
1
vote
0 answers
Trouble connecting to local mongo db since updating to mongoose 5.x
I've checked around Stack and the Mongoose docs for this, but I can't seem to get it right. As implied in the title everything was fine until i upgraded the packages for mongoose and connect-mongo.
Here's my database.js:
var mongoose =…
![](../../users/profiles/4769420.webp)
agursky
- 33
- 5
1
vote
1 answer
How to update express session outside of the request with connect mongo?
I am building an integration with Express Session and I am trying to authenticate the user in a separate webhook. So I need a way to update the user session outside of the request since it would be a different request.
What I did is I passed the…
![](../../users/profiles/9247020.webp)
Anthony Kung
- 373
- 2
- 4
- 15
1
vote
0 answers
Cannot get value of req.user for Passport.js
I spent hours figuring things out why I cannot get the value of req.user when Passport.js serialized a user. But magically, when I deleted the database collection that holds the session, it worked again.
My stack:
Vue.js
Express
Mongoose MongoDb (I…
![](../../users/profiles/14395964.webp)
ian natividad
- 69
- 4
1
vote
0 answers
All active session in mongoDB express-session
How can i get all active sessions using mongo store with express-session in nodejs. What i have tried is: store.all((err,session)=>{ console.log(session); })
But its in the same file where i have initialised mongo store, but i'm unable to use this…
![](../../users/profiles/9470836.webp)
dipesh patidar
- 21
- 5