question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Sessions] Support MongoDB as session storage

See original GitHub issue

Issue

We currently have TypeORMStore and RedisStore to store sessions in SQL and Redis databases. It is annoying for people using MongoDB with FoalTS. We should also support MongoDB session storage.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:14 (10 by maintainers)

github_iconTop GitHub Comments

2reactions
yaaminucommented, Aug 7, 2019

Important! I’m assuming that your clients are sending the session token either via the Authorization header or cookies as described in the documentation

You seem to be doing everything correctly regarding the session store setup. You are getting undefined because foal doesn’t support mongodb session store natively. You have to use the old and manual “express-session” way of managing sessions. This very issue exists to address that.

But while we await its implementation from @LoicPoullain , you can get access to the current request through context.request which you can treat as an express request instance so context.request.session should give you the current session.

Let me know if you need more assistance!

0reactions
LoicPoullaincommented, Sep 11, 2019

Feature added in v1.1.0

Read more comments on GitHub >

github_iconTop Results From Across the Web

Storing sessions with connect-mongo in MongoDB.
A session can temporarily store information related to the activities of the user while connected. For example, you can store a unique ...
Read more >
Best Session Storage Middleware for Express + MongoDB
Sessions work by matching a session ID inside a cookie to an ID in that database. So if you use it for a...
Read more >
Using MongoDb for Quick Session Storage with connect ...
Set up quick session storage for production environments in Express with connect-mongo and keep the focus on your application logic.
Read more >
Using MongoDB as a Session Store (How To) - Treehouse
In this lesson learn how to use a MongoDB-based data store for your session variables, which provides a scalable solution for a production...
Read more >
Server Sessions — MongoDB Manual
MongoDB's server sessions, or logical sessions, are the underlying framework used by client sessions to support Causal Consistency and retryable writes.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found