I was wondering if it's possible to attach a callback to be performed when a session is cleared? In my particular case, the session also stores the _id of a User model, and I'd like to delete the User with the session.
With more reading, I guess connect-mongo doesn't actually handle deleting of expired sessions, it just provides the variable to compare against. It is up to the app to cull old sessions?
connect-mongo will ask MongoDB to remove all the sessions that have expired before the current date. Since that call doesn't return a list of removed items, currently this isn't trivial to add.
However, this could be added as an option, where we run a find() to get all the expired sessions before removing them, and call your callback on the list of those sessions.
Was this ever implemented? thx!
Answer: re-implement your custom clear method.