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

allow automatic run of code from the stored library when loaded into context

    • Type: Icon: New Feature New Feature
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: JavaScript
    • None
    • Fully Compatible
    • Platforms F (01/29/16)

      There has been several tickets about how to upload a working library to the server, like:
      http://stackoverflow.com/questions/8418651/techniques-for-storing-libraries-in-mongodbs-system-js

      Turns out this is automatically done in v8: it will always run code as it is loaded.
      If you save:
      db.system.js.save({ _id: "mylib", value: "myprint = function()

      { print('installed'); return 'installed';" }

      Then you can use myprint() freely in your code

      With spidermonkey it is not done.
      We should standardize and make it so that:

      • by default code does not get run
      • if there is a flag set on the object "run: true" then run it as it is installed on context.

            Assignee:
            mira.carey@mongodb.com Mira Carey
            Reporter:
            antoine Antoine Girbal
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: