I created a MongoDB account on MongoLab cloud server and I have a DB created and its empty (no collection, just 1 user) as of now.
this is what the command given at Mongolab to connect to the DB
mongo dbh13.mongolab.com:27137/myDB -u <username> -p <password>
is the user name here mongolab account credentials or the user i created in the myDB there.? I tried both, it's not authorizing.
but if try to connect to directly with out authorization (from Windows), it worked with this command
mongo dbh13.mongolab.com:27137/myDB
but after which if i try to do something like show dbs/show collections it fails with the following message
> show dbs
assert failed开发者_JAVA百科 : listDatabases failed:{
"assertion" : "unauthorized db:admin lock type:-1 client:38.117.159.162"
,
"assertionCode" : 10057,
"errmsg" : "db assertion failure",
"ok" : 0
}
Fri Aug 12 16:30:50 uncaught exception: assert failed : listDatabases failed:{
"assertion" : "unauthorized db:admin lock type:-1 client:38.117.159.162"
,
"assertionCode" : 10057,
"errmsg" : "db assertion failure",
"ok" : 0
}
Any ideas?
I got the solution for authorization from windows shell
> mongo "dbh13.mongolab.com:27137/myDB"
MongoDB shell version: 1.6.5
connecting to: dbh13.mongolab.com:27137/myDB
> db.auth("<username>","<password>")
http://support.mongolab.com/entries/20177338-i-m-using-the-windows-mongo-shell-and-can-t-connect-help
精彩评论