use deleteMany and $in instead of deleteOne to delete expired sessions

Change-Id: I00462df4a3943f4b631160ccf721b6db730b0eff
This commit is contained in:
Axel Uhl committed 2019-02-03 20:41:06 +01:00
1 parent 12bee93c99
commit eeeac6bce2
1 file changed
+2 -1
@@ -42,7 +42,8 @@ public class DomainObjectFactoryImpl implements DomainObjectFactory {
Util.addToValueSet(sessionsByCacheName, cacheName, session);
}
});
expiredSessionIds.forEach(id->sessionsCollection.deleteOne(new Document(FieldNames.SESSION_ID.name(), id)));
final Document filter = new Document("$in", Util.map(expiredSessionIds, id->id.toString()));
sessionsCollection.deleteMany(new Document(FieldNames.SESSION_ID.name(), filter));
return sessionsByCacheName;
}