14

尝试直接访问 MongoHQ:

> mongo mongodb://heroku:mypassword@alex.mongohq.com:10046/myapp
MongoDB shell version: 2.4.3
connecting to: mongodb://heroku:mypassword@alex.mongohq.com:10046/myapp
Tue Jun  4 16:10:09.255   Assertion failure _setName.size() src/mongo/client/dbclientinterface.h 211
0x10017116b 0x100135396 0x100068356 0x100129bab 0x10010f92f 0x10024b2fa 0x139ba3a06362 0x139ba3a0ce93 0x139ba3a400c9 0x139ba3a0c76e 
 0   mongo                               0x000000010017116b _ZN5mongo15printStackTraceERSo + 43
 1   mongo                               0x0000000100135396 _ZN5mongo12verifyFailedEPKcS1_j + 310
 2   mongo                               0x0000000100068356 _ZN5mongo16ConnectionString5parseERKSsRSs + 1878
 3   mongo                               0x0000000100129bab _ZN5mongo17mongoConsExternalEPNS_7V8ScopeERKN2v89ArgumentsE + 187
 4   mongo                               0x000000010010f92f _ZN5mongo7V8Scope10v8CallbackERKN2v89ArgumentsE + 175
 5   mongo                               0x000000010024b2fa _ZN2v88internalL30Builtin_HandleApiCallConstructENS0_12_GLOBAL__N_116BuiltinArgumentsILNS0_21BuiltinExtraArgumentsE1EEEPNS0_7IsolateE + 618
 6   ???                                 0x0000139ba3a06362 0x0 + 21559186056034
 7   ???                                 0x0000139ba3a0ce93 0x0 + 21559186083475
 8   ???                                 0x0000139ba3a400c9 0x0 + 21559186292937
 9   ???                                 0x0000139ba3a0c76e 0x0 + 21559186081646
Tue Jun  4 16:10:09.264 JavaScript execution failed: Error: assertion src/mongo/client/dbclientinterface.h:211 at src/mongo/shell/mongo.js:L114
exception: connect failed

要做什么?

4

2 回答 2

24

这是一个shell bug,它不是一个新的。基本上,mongo shell 不接受与常规 mongodb 驱动程序相同的连接字符串格式。我可以在当前和以前的版本中重现此错误,并且此语法预计不会起作用(尽管它可能也不应该崩溃,但外壳程序已经存在一个错误以接受标准连接字符串:jira.mongodb.org /浏览/SERVER-3254

同时,您可以使用 mongo shell 选项进行连接,例如

mongo -u <user> -p <passwd> hostIP:port/db 

或者

mongo --host host --port port [ other options ] db
于 2013-06-05T03:54:59.510 回答
0

只需查看您的密码中是否包含 $,在这种情况下,将您的密码用 ' ' 括起来,然后尝试连接。

例如

mongo mongodb://host:port/authdb -username dbusername -p 'password$123'

于 2017-01-21T00:24:09.810 回答