When connecting using a connection string, attempting to use a bogus auth mechanism results in a descriptive error message:
> uri = "mongodb://user:pwd@host:port/example?authSource=$external&authMechanism=FAKE_METHOD" > new_client = MongoClient.from_uri(uri) Invalid value "fake_method" for authmechanism: must be one of GSSAPI, MONGODB-CR, MONGODB-X509, PLAIN
However if we authenticate through code, we get a less descriptive error message:
> client = MongoClient.new("host", port) > db = client.db("database") > db.authenticate(user, pwd, nil, "$external", FAKE_METHOD) undefined method `[]' for nil:NilClass