Store session creation date in session backends
I was debugging mongo and couldn't find the creation date in the session store. We should probably track this for all sessions; even if not tracked by UTC it does help with debugging. Perhaps the individual backends provide primitives for this as well that we can use.
Screenshot
I was trying to find from this screenshot which sessions were created today. It doesn't say, heh.

This view can be recreated by running this branch https://github.com/http-rs/tide/pull/664 and introspecting the database through MongoDB Compass.
Is there a production use case for this or is it just for development/debugging? If the latter, would this be sufficient:
use chrono::{DateTime, Utc};
app.with(Before(|mut request: Request<_>| async move {
let session = request.session_mut();
if session.get_raw("created").is_none() {
session.insert("created", Utc::now()).unwrap();
}
request
}));
Then it would be available within the serialized json data
Alternatively, there's no reason a session store couldn't add additional data to the record
Alternatively, there's no reason a session store couldn't add additional data to the record
Yeah that's what I was thinking -- for example MongoDB has a native DateTime object that can be used for serialization. For the default backends we expose it'd probably be useful to track creation time + time of last update. I don't believe MongoDB tracks this itself (it does serialize the creation date in the ID, but it can't be queried for afaict), so making that data available would be be useful.