title: Refresh Tokens in MongoDB
body: <p>What is the best solution to remove a refresh token from MongoDB automatically.</p>
  
  <p>On login the user is given a temporary auth token which lasts 30 seconds. They are also given a permanent token, stored in MongoDB, which currently lasts until they log out.</p>
  
  <p>I want to remove the permanent one at the end of every day, but I'm not sure how to do that without having a cron job running (to monitor what time it is). This seems a bit complex for such a small task. Is there a way mongo would know what the time is and then remove the refresh token?</p>
  
  <p>This is how the token collection looks:</p>
  
  <p><a href="https://i.stack.imgur.com/Ee5jh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Ee5jh.png" alt="enter image description here"></a></p>
  
  <p>Thank you</p>