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

Shell breaks when a multiline function is input

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Critical - P2 Critical - P2
    • 3.0.0-rc8
    • Affects Version/s: 3.0.0-rc7
    • Component/s: Shell
    • Labels:
      None
    • Fully Compatible
    • ALL
    • Hide

      At the bash prompt:

      echo "db.collection.find({" > broken_pipe.js
      echo "})" >> broken_pipe.js
      cat broken_pipe.js| mongo
      

      This gives the output:

      MongoDB shell version: 3.0.0-rc7
      connecting to: test
      2015-02-03T16:47:26.299-0500 E QUERY    SyntaxError: Unexpected token ILLEGAL
      error2:SyntaxError: Unexpected token ILLEGAL
      User interrupt detected; exiting...
      

      Contrast this with:

      mongo broken_pipe.js
      

      which gives the output:

      MongoDB shell version: 3.0.0-rc7
      connecting to: test
      

      Note that this break happened between 2.8.0-rc5 and 3.0.0-rc6.

      Show
      At the bash prompt: echo "db.collection.find({" > broken_pipe.js echo "})" >> broken_pipe.js cat broken_pipe.js| mongo This gives the output: MongoDB shell version: 3.0.0-rc7 connecting to: test 2015-02-03T16:47:26.299-0500 E QUERY SyntaxError: Unexpected token ILLEGAL error2:SyntaxError: Unexpected token ILLEGAL User interrupt detected; exiting... Contrast this with: mongo broken_pipe.js which gives the output: MongoDB shell version: 3.0.0-rc7 connecting to: test Note that this break happened between 2.8.0-rc5 and 3.0.0-rc6.

      The mongo shell breaks when given a multiline function, either directly in the shell or when piped in.

      This is a problem because breaking functions into multiple lines can dramatically improve readability, and does not change the fact that they are valid javascript.

            Assignee:
            benety.goh@mongodb.com Benety Goh
            Reporter:
            william.cross William Cross
            Votes:
            0 Vote for this issue
            Watchers:
            8 Start watching this issue

              Created:
              Updated:
              Resolved: