MongoVUE connect to mongodb with authencation failed! I had a mongodb, and a database named genbank. Genbank has a user whose role is "read" and "readAnyDatabase". It is very strange that I cannot connect to genbank through this role by MongoVUE, but I can connect successfully under administrator role.

The connection configuration is:



genbankReader is the username for genbank database.

the error message is:

Unable to connect to server *.*.*.*:40000: Invalid credential for database 'admin'..
Type: MongoDB.Driver.MongoConnectionException
Stack:    在 MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)
   在 MongoDB.Driver.MongoServer.Connect(TimeSpan timeout)
   在 MongoDB.Driver.MongoServer.Connect()
   在 MangoUI.MMongo.m7FnMeKibMFwcOmRDx4q(Object )
   在 MangoUI.MMongo.Open(Boolean useSamus)
   在 MangoUI.MMongo.Open()
   在 MangoUI.ComNavTree.d0Pck1r6Vh91JYOyd29(Object )
   在 MangoUI.ComNavTree.ExpandMe(MTreeNode expand)
   在 MangoUI.ComNavTree.tree_BeforeExpand(Object sender, TreeViewCancelEventArgs e)


Invalid credential for database 'admin'.
Type: MongoDB.Driver.MongoAuthenticationException
Stack:    在 MongoDB.Driver.Communication.Security.MongoCRAuthenticationProtocol.Authenticate(MongoConnection connection, MongoCredential credential)
   在 MongoDB.Driver.Communication.Security.Authenticator.Authenticate(MongoCredential credential)
   在 MongoDB.Driver.Communication.Security.Authenticator.Authenticate()
   在 MongoDB.Driver.Internal.MongoConnection.Open()
   在 MongoDB.Driver.Internal.MongoConnection.GetNetworkStream()
   在 MongoDB.Driver.Internal.MongoConnection.SendMessage(BsonBuffer buffer, MongoRequestMessage message, WriteConcern writeConcern, String databaseName)
   在 MongoDB.Driver.Internal.MongoConnection.SendMessage(MongoRequestMessage message, WriteConcern writeConcern, String databaseName)
   在 MongoDB.Driver.Internal.MongoConnection.RunCommandAs[TCommandResult](String databaseName, QueryFlags queryFlags, CommandDocument command, IBsonSerializer commandResultSerializer, IBsonSerializationOptions commandResultSerializationOptions, Boolean throwOnError)
   在 MongoDB.Driver.Internal.MongoConnection.RunCommandAs[TCommandResult](String databaseName, QueryFlags queryFlags, CommandDocument command, Boolean throwOnError)
   在 MongoDB.Driver.MongoServerInstance.Ping(MongoConnection connection)
   在 MongoDB.Driver.MongoServerInstance.Connect()
   在 MongoDB.Driver.Internal.DirectMongoServerProxy.Connect(TimeSpan timeout, ReadPreference readPreference)


Command 'authenticate' failed: auth fails (response: { "code" : 18, "ok" : 0.0, "errmsg" : "auth fails" })
Type: MongoDB.Driver.MongoCommandException
Stack: 
Inputs:: 
Command:  authenticate
Ok:       False
ErrorMsg: auth fails
Request:  { "authenticate" : 1, "user" : "genbankReader", "nonce" : "264abe28fc4dd95", "key" : "ca2124ded060247d527941e55820fd80" }
Response: { "code" : 18, "ok" : 0.0, "errmsg" : "auth fails" }


My db user always uses mongoVUE but I cannot give him other privilege except for read. So, can any one help me solve my problem?
Your error looks like a standard "auth failed" exception... If all the parameters of your connection are correct for your setup, I'd suggest you try to logon from the mongo shell directly:

$&gt;mongo 1.2.3.4:40000/genbank  -u genBankReader -p passwd1234 --authenticationDatabase admin --verbose

Use the --verbose flag to log on as both the "read-only" user and the "admin" user and see if you can tell more of what's wrong (if any).

Alternative you can use another mongo client GUI like Robomongo and see if that works.
(I used to use MongoVue but switched to Robomongo as it was less confusing and more shell-oriented)

Otherwise, you could have setup/added the users incorrectly. Use the admin user to check db.system.users collection of the proper database just to make sure. Perhaps take another look at http://docs.mongodb.org/manual/reference/privilege-documents/ 

Hope this helps, good luck