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

Shell exits with successful return code upon failure

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • 2.5.1
    • Affects Version/s: 2.2.2
    • Component/s: Shell
    • None
    • ALL

      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 }

            Assignee:
            tad Tad Marshall
            Reporter:
            chengas123 Ben McCann
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: