Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2573

Ability to schedule javascript functions to run @ cron like intervals on the server

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: Usability
    • Labels:
      None
    • Case:

      Description

      It would be nice to be able to schedule tasks/javascript functions to run inside mongo at fixed intervals (via the drivers).

      This would make random jobs easier to code. Currently, I'm executing code that a cron calls via HTTP and this results in a bit of unnecessary framework code in my application.

      Most databases support scheduled stored proc execution.

      The ability to configure the scheduled proc so that it runs in parallel on shards, would be very handy too

      E.g.

      Once per minute, I would like to run:

      • * * * * updateHostClusterIds

      // Syntax may be off a bit

      function updateHostClusterIds(currentTime, shardId) {
      db.clusters.find().forEach( function(cluster) {
      db.hosts.update({ _id: { $in :

      { cluster.hostIds }

      }}, { $set: { clusterId : cluster._id }}, false, true);
      });
      }

        Attachments

          Activity

            People

            • Votes:
              10 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: