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

Running DBRef() with no parameter crashes mongosh

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 0.4.2
    • Affects Version/s: None
    • Component/s: CLI Module
    • None
    • Iteration Maracuja
    • Needed
    • Hide

      NumberInt, NumberLong, and NumberDecimal only accept strings.

      Show
      NumberInt, NumberLong, and NumberDecimal only accept strings.

      When I run DBRef() with no option / parameter, I get an UnhandledPromiseRejectionWarning which results in the shell freezing up and I have to quit / restart.

      Here is the exact output:

      > DBRef()
      (node:29726) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'toString' of undefined
          at DBRef.asPrintable (/snapshot/cli-repl/node_modules/@mongosh/service-provider-server/node_modules/@mongosh/service-provider-core/lib/printable-bson.js:17:66)
          at formatValue (internal/util/inspect.js:693:31)
          at Object.inspect (internal/util/inspect.js:264:10)
          at inspect (/snapshot/cli-repl/lib/format-output.js)
          at formatSimpleType (/snapshot/cli-repl/lib/format-output.js)
          at Object.formatOutput [as default] (/snapshot/cli-repl/lib/format-output.js)
          at REPLServer.writer (/snapshot/cli-repl/lib/cli-repl.js)
          at finish (repl.js:801:38)
          at CliRepl.<anonymous> (/snapshot/cli-repl/lib/cli-repl.js)
          at step (/snapshot/cli-repl/lib/cli-repl.js)
      (node:29726) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
      (node:29726) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
      

      In contrast, the legacy mongo shell returns an error with "Error: DBRef needs 2 or 3 arguments :", but it doesn't completely freeze / lock the shell.

            Assignee:
            anna.herlihy@mongodb.com Anna Herlihy (Inactive)
            Reporter:
            jeffrey.allen@mongodb.com Jeffrey Allen
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: