Attach callback into clearInterval #27

Closed
superlou opened this Issue Feb 21, 2012 · 4 comments

Comments

Projects
None yet
4 participants
@superlou

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.

@superlou

This comment has been minimized.

Show comment Hide comment
@superlou

superlou Feb 21, 2012

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?

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?

@kcbanner

This comment has been minimized.

Show comment Hide comment
@kcbanner

kcbanner Apr 14, 2012

Collaborator

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.

Collaborator

kcbanner commented Apr 14, 2012

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.

@nowherenearithaca

This comment has been minimized.

Show comment Hide comment
@nowherenearithaca

nowherenearithaca Mar 15, 2014

Was this ever implemented? thx!

Was this ever implemented? thx!

@jdesboeufs

This comment has been minimized.

Show comment Hide comment
@jdesboeufs

jdesboeufs Dec 23, 2014

Owner

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

Owner

jdesboeufs commented Dec 23, 2014

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

@jdesboeufs jdesboeufs closed this Dec 23, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment