我在MongoLab云服务器上创建了一个MongoDB帐户,我创建了一个数据库,它现在是空的(没有集合,只有1个用户).
这是Mongolab为连接数据库而给出的命令
mongo dbh13.mongolab.com:27137/myDB -u-p
是这里的用户名mongolab帐户凭据或我在myDB中创建的用户.?我试过了两个,它没有授权.
但如果尝试直接连接到授权(从Windows),它可以使用此命令
mongo dbh13.mongolab.com:27137/myDB
但之后,如果我尝试做类似show dbs/show collections的事情,它会失败并显示以下消息
> show dbs assert failed : 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 }
有任何想法吗?
我从windows shell获得了授权解决方案
> mongo "dbh13.mongolab.com:27137/myDB" MongoDB shell version: 1.6.5 connecting to: dbh13.mongolab.com:27137/myDB > db.auth(""," ")
http://support.mongolab.com/entries/20177338-im-using-the-windows-mongo-shell-and-can-t-connect-help