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

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major - P3 Major - P3
    • 2.5.0
    • 1.8.4, 2.0.4
    • JavaScript
    • This fails on OsX and Linux.
    • Minor Change
    • ALL

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved: