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

The string "return," passed as a parameter to MongoDB function calls, causes Javascript to return

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.0
    • Affects Version/s: 1.8.4, 2.0.4
    • Component/s: JavaScript
    • Labels:
    • Environment:
      This fails on OsX and Linux.
    • Minor Change
    • ALL

      Passing the string "return" to a JavaScript function apparently causes JavaScript to return abnormally. Here is the simplest example I have:

      MongoDB shell version: 2.0.4
      connecting to: test
      > db.system.js.save({_id: "error20", value: function(a) {return a}})
      > db.eval("error20(\"test\")")
      test
      > db.eval("error20(\"return\")")
      null

      Attached is a file showing the same function working for both node.js and the JavaScript interpreter in Chrome.

            Assignee:
            andrew.emil@10gen.com Andrew Emil (Inactive)
            Reporter:
            willnik Will Fitzgerald
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: