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

    • New Feature
    • Status: Closed
    • Major - P3
    • Resolution: Won't Fix
    • None
    • None
    • Usability
    • None

    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

            Unassigned Unassigned
            rgnitz Ryan Nitz
            Votes:
            10 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: