You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm submitting a ...
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[x] question about how to use this project
Summary
What's the recommended way to add timestamps to Session documents? I'm looking for something similar to this behavior in mongoose. My naive approach would be to use the serialize hook to add a createdAt property there. If that's the best way it could be nice to have a more declarative way to add this field.
The text was updated successfully, but these errors were encountered:
Hello @ilias-t I took a look into the projects file since I have the same feeling that having some timestamps maybe of use. At first glance it seems the InternalSessionType should be extended with that property createdAt then on session object creation it should be initialized right before removing the lastModified prop from the session object before update.
Rephrasing your mongoose reference maybe we are shooting for something like:
...connect-mongo will then set createdAt when the document is first inserted (create event fires), and update updatedAt whenever you update the document (update/set events fire).
Sending a forked tryout to discuss further this idea.
CarlosLunaGit
pushed a commit
to CarlosLunaGit/connect-mongo
that referenced
this issue
Oct 22, 2023
I'm submitting a ...
[ ] bug report
[ ] feature request
[ ] question about the decisions made in the repository
[x] question about how to use this project
Summary
What's the recommended way to add timestamps to Session documents? I'm looking for something similar to this behavior in mongoose. My naive approach would be to use the
serialize
hook to add acreatedAt
property there. If that's the best way it could be nice to have a more declarative way to add this field.The text was updated successfully, but these errors were encountered: