Skip to content


Subversion checkout URL

You can clone with
Download ZIP


Attach callback into clearInterval #27

superlou opened this Issue · 4 comments

4 participants


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!


Too specific.
Answer: re-implement your custom clear method.

@jdesboeufs jdesboeufs closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.