If you want to set mongoose to refresh data regularly every day, do you have any ideas from your predecessors?

  mongodb, question

It suddenly occurred to me that if you want to set a timer, you have to have a timer switch. If you have a timer switch, you have to have judgment. If you have judgment, you have to have the conditions to trigger judgment. How do you design the conditions to trigger judgment? Ask the thighs to give some ideas

mongooseIs responsible for accessing the database, which is actually different from a scheduled task. What you need is a tool that can trigger tasks regularly. There are many implementations in NodeJS, such asnode schedule, their function is to trigger tasks at regular intervals.
If from the system level, Linux hascron job, you can also use cron job to start nodejs to refresh the data.
MongoDB itself supports simple periodic deletion of data.TTL Index.
How to choose depends on your specific needs.