SERVER-305 record uri on connect

This commit is contained in:
Aaron
2010-02-22 10:32:55 -08:00
parent 6ebe1c9532
commit ae80a66ff8
7 changed files with 22 additions and 6 deletions

View File

@@ -675,8 +675,6 @@ namespace mongo {
#endif
}
vector< string > _allMyUris;
void initScope( Scope &scope ) {
scope.externalSetup();
mongo::shellUtils::installShellUtils( scope );
@@ -684,14 +682,18 @@ namespace mongo {
if ( !_dbConnect.empty() ) {
uassert( 12513, "connect failed", scope.exec( _dbConnect , "(connect)" , false , true , false ) );
uassert( 13010, "whatsmyuri failed", scope.exec( "__myuri = db.runCommand( {whatsmyuri:1} ).you", "(whatsmyuri)", false , true , false ) );
string uri = scope.getString( "__myuri" );
_allMyUris.push_back( uri );
if ( !_dbAuth.empty() ) {
installGlobalUtils( scope );
uassert( 12514, "login failed", scope.exec( _dbAuth , "(auth)" , true , true , false ) );
}
}
}
vector< string > _allMyUris;
void onConnect( DBClientWithCommands &c ) {
BSONObj info;
uassert( 13010, "whatsmyuri failed", c.runCommand( "admin", BSON( "whatsmyuri" << 1 ), info ) );
_allMyUris.push_back( info[ "you" ].str() );
}
}
}