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

XMLWordPrintableJSON

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

      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 (Inactive)
              Reporter:
              Will Fitzgerald
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Created:
                Updated:
                Resolved: