Skip to content

Commit

Permalink
indicate in shell prompt when connected to a configsvr.
Browse files Browse the repository at this point in the history
  • Loading branch information
dwight committed Sep 20, 2011
1 parent b67fee1 commit 7399d40
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions db/repl/rs.h
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,9 @@ namespace mongo {
bool check(string& errmsg, BSONObjBuilder& result) {
if( !replSet ) {
errmsg = "not running with --replSet";
if( cmdLine.configsvr ) {
result.append("info", "configsvr"); // for shell prompt
}
return false;
}

Expand Down
6 changes: 4 additions & 2 deletions shell/dbshell.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -549,8 +549,10 @@ string sayReplSetMemberState() {
MemberState ms(s);
return ms.toString();
}
else if( str::equals(info.getStringField("info"), "mongos") ) {
return "mongos";
else {
string s = info.getStringField("info");
if( s.size() < 20 )
return s; // "mongos", "configsvr"
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion shell/mongo_vstudio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1673,7 +1673,8 @@ const StringData _jscode_raw_utils =
"else if (x == \"\") {\n"
"print(\"\\t\" + \"db.help() help on db methods\");\n"
"print(\"\\t\" + \"db.mycoll.help() help on collection methods\");\n"
"print(\"\\t\" + \"rs.help() help on replica set methods\");\n"
"print(\"\\t\" + \"sh.help() sharding helpers\");\n"
"print(\"\\t\" + \"rs.help() replica set helpers\");\n"
"print(\"\\t\" + \"help admin administrative help\");\n"
"print(\"\\t\" + \"help connect connecting to a db help\");\n"
"print(\"\\t\" + \"help keys key shortcuts\");\n"
Expand Down

0 comments on commit 7399d40

Please sign in to comment.