Closed pablojsx closed 1 year ago
Hello, this method is implemented by the store module you are using, which may need to fiz their implementation. What store are you using?
Hello, this method is implemented by the store module you are using, which may need to fiz their implementation. What store are you using?
Hello Doug!. I'm using the MongoDBStore
Thanks! It looks like we have a couple of MongoDB ones listed. Do you happen to know the name of the npm module?
Thanks! It looks like we have a couple of MongoDB ones listed. Do you happen to know the name of the npm module?
Yep this is all I have for the server:
Ok, cool. It is connect-mongodb-session. Here is where that module implements the .all method that is return what you are not expecting: https://github.com/mongodb-js/connect-mongodb-session/blob/50c80519f54983c3d0a2f6ee6828bacffa5c58dd/index.js#L152
And here is their bug tracker to report the issue: https://github.com/mongodb-js/connect-mongodb-session/issues
In Javascript it works fine, but the problem start when you use Typescript since the types won't match the info!
Ok, cool. It is connect-mongodb-session. Here is where that module implements the .all method that is return what you are not expecting: https://github.com/mongodb-js/connect-mongodb-session/blob/50c80519f54983c3d0a2f6ee6828bacffa5c58dd/index.js#L152
And here is their bug tracker to report the issue: https://github.com/mongodb-js/connect-mongodb-session/issues
Thanks for your help Doug, I'll report the bug now
I'm using express-session with tRPC and in my context:
I wanted to get all user sessions from the database, I tried " req.sessionStore.all" and also " store.client.db().collection('sessions');" but with both I'm getting the same issue. I get the information but it's not of the type that it should be and it is nested inside another array!.
When I get the information from the callback req.sessionStore.all receives I get this:
All good but this array isn't a "sessionData[]" array. What I mean is that when you use req.sessionStore.all it will return from the callback a sessions array and that's a "sessionData[]" array that doesn't match the info from the pic above.
I get the information but it is nested!! in the pic below, the session
You can see here what I mean, the info is nested:
If I destructure the session object:
If I cast the information everything works!