根据api中提供的ConnectionString类的方式连接mongodb分片集群,报以下错误:
"Cannot list multiple servers in URL without 'replicaSet' option"
mongodb分片集群明显指定不了复制集名称啊,很困惑是否legacy的版本已经不支持分片了,求大师指导有无其他方案?
Examples:
*
- A replica set with three members (one running on default port 27017):
- string uri = mongodb://localhost,localhost:27018,localhost:27019
* - Authenticated connection to db 'bedrock' with user 'barney' and pwd 'rubble':
- string url = mongodb://barney:rubble@localhost/bedrock
* - Use parse() to parse the url, then validate and connect:
- string errmsg;
- ConnectionString cs = ConnectionString::parse( url, errmsg );
- if ( ! cs.isValid() ) throw "bad connection string: " + errmsg;
- DBClientBase * conn = cs.connect( errmsg );