summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2010-06-03 16:58:14 -0400
committerMathias Stearn <mathias@10gen.com>2010-06-03 16:58:46 -0400
commit124efbfd638ff59353b56a940e0f0ed6ea45deaa (patch)
tree03c700418617be485d29bdce791be4eb98332caa /tools
parent307b6e86f695ba9d1fa798d7af308b59ce57cac8 (diff)
downloadmongo-124efbfd638ff59353b56a940e0f0ed6ea45deaa.tar.gz
Add --port option to tools. SERVER-1157
Diffstat (limited to 'tools')
-rw-r--r--tools/tool.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/tool.cpp b/tools/tool.cpp
index 2e62f857745..14211052da7 100644
--- a/tools/tool.cpp
+++ b/tools/tool.cpp
@@ -45,6 +45,7 @@ namespace mongo {
("help","produce help message")
("verbose,v", "be more verbose (include multiple times for more verbosity e.g. -vvvvv)")
("host,h",po::value<string>(), "mongo host to connect to (\"left,right\" for pairs)" )
+ ("port",po::value<string>(), "server port. Can also use --host hostname:port" )
("db,d",po::value<string>(), "database to use" )
("collection,c",po::value<string>(), "collection to use (some commands)" )
("username,u",po::value<string>(), "username" )
@@ -146,6 +147,9 @@ namespace mongo {
_host = "127.0.0.1";
if ( _params.count( "host" ) )
_host = _params["host"].as<string>();
+
+ if ( _params.count( "port" ) )
+ _host += ':' + _params["port"].as<string>();
if ( _noconnection ){
// do nothing