Maintain a variable with the user session

Hi, I need to keep a variable until I spend some time. For example, you can not enter a route, until the person logged in does not spend 3 hours after the event has started.
I thought I would save it in a mongoDB database to a variable that represents the day for each user, but I would have one document per user to represent where it goes. Is that the best option?

That sounds like the best way to do it. There is a package called persistent session that I think saves session variables in local storage, but this is lost across devices etc.

You say it’s an event that the user needs to wait a certain amount of time for? Probably best to store in mongo as you suggested. If you have a lot of data to store that’s time based, I’ve have found storing dates as epochs to be efficient

Hi, thank you very much, if you imagine saving a date in mongoDB per client, if that date is equal to or greater than the current one then you can access the specified route. I’m looking forward to making a simple MMORPG, and the countdown is essential. thank you very much.