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

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

      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);
      });
      }

            Assignee:
            Unassigned Unassigned
            Reporter:
            rn@deftlabs.com Ryan Nitz
            Votes:
            10 Vote for this issue
            Watchers:
            7 Start watching this issue

              Created:
              Updated:
              Resolved: