Hi @argjendhaxhiu ,
I would recommend what @saiki mentioned. But this method won't work well if you need to query and list all "online" users in the system at any point. If this is a necessity, I suggest you use something like node-schedule to run a cron job every 30s or 1m and insert online users into a separate collection, say onlineusers and remove the offline ones from the same. However, if this is not a requirement, go with the approach mentioned by @saiki .