Event scheduler (cronjob) in MongoDB?

后端 未结 2 1482
再見小時候
再見小時候 2021-01-25 06:00

How can i set an event in Mongodb?

I will create an event that every 4 hours Calculate fields (SUM|COUNT) in the Collection And Save it. What is the best So

相关标签:
2条回答
  • 2021-01-25 06:26

    As of version 3.2 MongoDB has no buildin cronjob system (with the exception of the TTL index auto-delete jobs, but these won't help you to solve this problem).

    That means you will have to use an external tool to start the mongo shell with your query as a parameter to it. There are countless tools available for this, some build into all common operating systems out-of-the box and some in form of 3rd party tools. There are far too many options to list them all and which one is the best depends on your IT infrastructure and what your system administrators prefer.

    0 讨论(0)
  • 2021-01-25 06:28

    Try MongoDB Cron package. It's a simple API for scheduling tasks and running recurring jobs on MongoDB collections. Any collection can be converted into a job queue or crontab list.

    0 讨论(0)
提交回复
热议问题