1 min readMay 20, 2020
How about this idea?
Instead of Cloud Task, we can maintain a separate collection of articles that will expire at a particular time.
currentTime + expiresIn : {
articleId1 = 1
articleId2 = 1
articleId3 = 1
}
A Cron Job will run daily on the server to fetch the articles that are going to expire at that time and will delete those articles.
But before deleting, we need to check if the expirationTime of the article is less then or equal to the time when the Cron Job runs.