JavaScript执行失败连接到mongoHQ shell

时间:2013-06-04 23:17:31

标签: mongodb mongohq

尝试直接访问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

要做什么?

2 个答案:

答案 0 :(得分:24)

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

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

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

mongo --host host --port port [ other options ] db

答案 1 :(得分:0)

只要查看您的密码是否有$,就可以在该方案中附上您的密码&#39; &#39;然后尝试连接。

e.g。

  

mongo mongodb:// host:port / authdb -username   dbusername -p&#39;密码$ 123&#39;