Connect-Mongo: How To Call Event/Method/Code After A Cookie Expires?

I’m using connect-mongo to implement an add-to-cart feature. It works fine. This is how it’s set up in my Express app:

var MongoStore = require('connect-mongo')(session);
// *              Code In Between                  *//
	secret: "foo",
	resave: false,
	saveUninitialized: false,
  store: new MongoStore({ mongooseConnection: mongoose.connection }),
  cookie: { maxAge: 180 * 60 * 1000 }

What I want now is to update inventory by accessing the database when a user clicks on “add to cart”. That’s easy enough. But I’m not sure how to put back the item in the database AFTER a session expires. I’m not asking how to put back an item into a database, I’m just asking how to call on post-expire events/methods/code in general? How can I let my app know when a session expires and let it do something after a session expires?

Not familiar with the Mongo API, but if the user adds to cart then just leaves it, then you can just periodically run a cull of those records. You normally don’t want to automatically delete them immediately because the session could have ended without the user wanting that, or they may just want to come back to the basket (see Amazon for example – common use is to store things in the basket to complete the purchase at some future date).

Add a TTL timestamp field on the record (so some time in the future), when they’re added set the TTL field, when you do the periodic check, delete all records where the current date > TTL