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

Shell can't print invalid or native functions stored in a document

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Trivial - P5
    • Resolution: Gone away
    • Affects Version/s: 2.6.11, 3.0.7, 3.2.0-rc5
    • Fix Version/s: None
    • Component/s: JavaScript, Shell
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      db.test.insert({a:print})
      db.test.find()
      

      Show
      db.test.insert({a:print}) db.test.find()
    • Sprint:
      TIG 11 (03/11/16)

      Description

      attempting to store and find an invalid or native function from the shell gives a SyntaxError.

      It looks like the cause is that the shell attempts to eval a function in a document, which would fail if the function is invalid.

      2015-12-02T15:04:39.330-0500 E QUERY    [thread1] SyntaxError: missing ] after element list :
      tojsonObject@src/mongo/shell/types.js:701:13
      tojson@src/mongo/shell/types.js:647:17
      DBQuery.prototype.shellPrint@src/mongo/shell/query.js:522:65
      shellPrintHelper@src/mongo/shell/utils.js:462:1
      @(shell2):1:1
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              robert.guo Robert Guo
              Reporter:
              robert.guo Robert Guo
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: