From f2e7296d19d9c3a8face892e2b95b31ce1e3f1b4 Mon Sep 17 00:00:00 2001 From: "John R. Supplee" Date: Mon, 25 Jan 2021 16:12:33 +0200 Subject: [PATCH] Remove old session data --- server/publications/cards.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/server/publications/cards.js b/server/publications/cards.js index 50ba202b4..b231cfe6c 100644 --- a/server/publications/cards.js +++ b/server/publications/cards.js @@ -547,7 +547,19 @@ Meteor.publish('globalSearch', function(sessionId, queryParams) { }); } - SessionData.upsert({ userId: this.userId, sessionId }, update); + SessionData.upsert({ userId, sessionId }, update); + + // remove old session data + SessionData.remove({ + userId, + modifiedAt: { + $lt: new Date( + moment() + .subtract(1, 'day') + .format(), + ), + }, + }); if (cards) { const boards = [];