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

Shell exits with successful return code upon failure

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 2.2.2
    • Fix Version/s: 2.5.1
    • Component/s: Shell
    • Labels:
      None
    • Operating System:
      ALL

      Description

      If I run a command with a bad username and password as shown below, the shill prints an error message, but returns with a successful return code. This makes it difficult to detect an error when executing the shell from another script. E.g. I have a script which uses the shell to lock the database, take a backup, and unlock the database and I'd like to detect an error with the bad username or password.

      $ mongo -u myuser -p badpassword mydatastore --eval "printjson(db.fsyncLock())"
      MongoDB shell version: 2.2.2
      connecting to: mydatastore

      { "errmsg" : "need to login", "ok" : 0 }

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: