我使用mongoose
url 连接到数据库:
console.log(mongourl);
mongoose.connect(mongourl);
mongoose.connection.on('connected', function() {
console.log('mongodb: connected');
});
在控制台中:
mongodb://localhost:27017/appname_development
mongodb: connected
但是当我尝试连接交互式提示时:
$ mongo mongodb://localhost:27017/appname_development
它爆炸了:
Wed Oct 2 14:43:57.390 Assertion failure _setName.size() src/mongo/client/dbclientinterface.h 211
0x10017116b 0x100135396 0x100068356 0x100129bab 0x10010f92f 0x10024b2fa 0x11b21ae06362 0x11b21ae0ce93 0x11b21ae400c9 0x11b21ae0c76e
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 ??? 0x000011b21ae06362 0x0 + 19456652764002
7 ??? 0x000011b21ae0ce93 0x0 + 19456652791443
8 ??? 0x000011b21ae400c9 0x0 + 19456653000905
9 ??? 0x000011b21ae0c76e 0x0 + 19456652789614
Wed Oct 2 14:43:57.393 JavaScript execution failed: Error: assertion src/mongo/client/dbclientinterface.h:211 at src/mongo/shell/mongo.js:L114
exception: connect failed