Uploaded image for project: 'MongoDB Shell'
  1. MongoDB Shell
  2. MONGOSH-722

TypeError: Cannot read property 'startsWith' of undefined

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.12.1
    • Affects Version/s: None
    • Component/s: History
    • None
    • Iteration Athens
    • Not Needed

      Problem Description

      Current Mongosh Log ID: 60870e2c903b776156b944dc
      Connecting to:    mongodb://127.0.0.1:27017/?directConnection=true&serverSelectionTimeoutMS=2000
      Using MongoDB:      5.0.0-alpha-257-ga73671c
      Using Mongosh Beta: 0.12.0
      
      For mongosh info see: https://docs.mongodb.com/mongodb-shell/
      
      ------
         The server generated these startup warnings when booting:
         2021-04-26T08:37:02.591-07:00: Access control is not enabled for the database. Read and write access to data and configuration is unrestricted
      ------
      
      Warning: Found ~/.mongorc.js, but not ~/.mongoshrc.js. ~/.mongorc.js will not be loaded.
        You may want to copy or rename ~/.mongorc.js to ~/.mongoshrc.js.
      Enterprise repl0 [direct: primary]>
      
      Enterprise repl0 [direct: primary]> readline.js:1154
                  throw err;
                  ^
      
      TypeError: Cannot read property 'startsWith' of undefined
          at PrettyREPLServer.Interface._historyPrev (readline.js:701:34)
          at PrettyREPLServer.Interface._ttyWrite (readline.js:1048:14)
          at PrettyREPLServer.REPLServer.self._ttyWrite (repl.js:907:9)
          at LineByLineInput.onkeypress (readline.js:213:10)
          at LineByLineInput.emit (events.js:315:20)
          at LineByLineInput.EventEmitter.emit (domain.js:467:12)
          at emitKeys (internal/readline/utils.js:345:14)
          at emitKeys.next (<anonymous>)
          at LineByLineInput.onData (readline.js:1144:36)
          at LineByLineInput.emit (events.js:315:20)
      

      Steps to Reproduce

      1. start mongosh
      2. Do not type any text and press enter.
      3. Press the up arrow.
      4. mongosh crashes with "TypeError: Cannot read property 'startsWith' of undefined"

      Expected Results

      mongosh should not crash.

      Additional Notes

      This my first time ever launching mongosh on this system. After I actually execute one line of code, this error goes away.

            Assignee:
            anna.henningsen@mongodb.com Anna Henningsen
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: