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