2012年10月29日星期一

MongoDB: Why "Uncaught exception 'MongoConnectionException... endpoint not connected"

在 PHP 中访问 MongoDB,建立连接时收到异常:
[bash gutter="fasle"]
"Uncaught exception 'MongoConnectionException transport endpoint is not connected"
[/bash]

Mongo Exception 中有说明引发这异常的原因:

Transport endpoint is not connected
Generally means that the connection string isn't correct, the driver couldn't even find the database server.


具体就是指定义提供服务的 server 的格式不对,正常的格式是: mongodb://[username:password@]host1[:port1][,host2[:port2:],...]/db

没有评论:

发表评论