summaryrefslogtreecommitdiff
path: root/src/mongo/client/mongo_uri.h
diff options
context:
space:
mode:
authorJonathan Reams <jbreams@mongodb.com>2016-11-29 20:01:18 -0500
committerJonathan Reams <jbreams@mongodb.com>2016-12-08 10:44:05 -0500
commitd55eb9d186f3039695a4d710116e79ad04536409 (patch)
treed7eeb820a9365d9266f926969177c05a9413e300 /src/mongo/client/mongo_uri.h
parente91795212e7f274db6eb66efd5bbad8f144cdf32 (diff)
downloadmongo-d55eb9d186f3039695a4d710116e79ad04536409.tar.gz
SERVER-27210 Allow shell to connect to replicasets with ssl=true in URI
Diffstat (limited to 'src/mongo/client/mongo_uri.h')
-rw-r--r--src/mongo/client/mongo_uri.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/mongo/client/mongo_uri.h b/src/mongo/client/mongo_uri.h
index 8a0574540c8..7b6364761d5 100644
--- a/src/mongo/client/mongo_uri.h
+++ b/src/mongo/client/mongo_uri.h
@@ -72,7 +72,9 @@ public:
static StatusWith<MongoURI> parse(const std::string& url);
- DBClientBase* connect(StringData applicationName, std::string& errmsg) const;
+ DBClientBase* connect(StringData applicationName,
+ std::string& errmsg,
+ boost::optional<double> socketTimeoutSecs = boost::none) const;
const std::string& getUser() const {
return _user;
@@ -106,6 +108,14 @@ public:
return _connectString.getServers();
}
+ // If you are trying to clone a URI (including its options/auth information) for a single
+ // server (say a member of a replica-set), you can pass in its HostAndPort information to
+ // get a new URI with the same info, except type() will be MASTER and getServers() will
+ // be the single host you pass in.
+ MongoURI cloneURIForServer(const HostAndPort& hostAndPort) const {
+ return MongoURI(ConnectionString(hostAndPort), _user, _password, _database, _options);
+ }
+
ConnectionString::ConnectionType type() const {
return _connectString.type();
}