Permalink
Browse files

added getSiblingDB SERVER-2159

  • Loading branch information...
1 parent 37512ba commit 1808b5693904a2e89bfa96dcafdbea5e9d491987 @erh erh committed Nov 30, 2010
Showing with 21 additions and 12 deletions.
  1. +5 −0 jstests/apitest_db.js
  2. +8 −6 shell/db.js
  3. +8 −6 shell/mongo_vstudio.cpp
View
@@ -70,3 +70,8 @@ assert( asserted, "should have asserted" );
dd( "g" );
+
+
+assert.eq( "foo" , db.getSisterDB( "foo" ).getName() )
+assert.eq( "foo" , db.getSiblingDB( "foo" ).getName() )
+
View
@@ -12,10 +12,12 @@ DB.prototype.getMongo = function(){
return this._mongo;
}
-DB.prototype.getSisterDB = function( name ){
+DB.prototype.getSiblingDB = function( name ){
return this.getMongo().getDB( name );
}
+DB.prototype.getSisterDB = DB.prototype.getSiblingDB;
+
DB.prototype.getName = function(){
return this._name;
}
@@ -49,7 +51,7 @@ DB.prototype._dbCommand = DB.prototype.runCommand;
DB.prototype.adminCommand = function( obj ){
if ( this._name == "admin" )
return this.runCommand( obj );
- return this.getSisterDB( "admin" ).runCommand( obj );
+ return this.getSiblingDB( "admin" ).runCommand( obj );
}
DB.prototype._adminCommand = DB.prototype.adminCommand; // alias old name
@@ -289,7 +291,7 @@ DB.prototype.help = function() {
print("\tdb.getProfilingLevel() - deprecated");
print("\tdb.getProfilingStatus() - returns if profiling is on and slow threshold ");
print("\tdb.getReplicationInfo()");
- print("\tdb.getSisterDB(name) get the db at the same server as this one");
+ print("\tdb.getSiblingDB(name) get the db at the same server as this one");
print("\tdb.isMaster() check replica primary status");
print("\tdb.killOp(opid) kills the current operation in the db");
print("\tdb.listCommands() lists all the db commands");
@@ -591,7 +593,7 @@ DB.tsToSeconds = function(x){
* of date than that, it can't recover without a complete resync
*/
DB.prototype.getReplicationInfo = function() {
- var db = this.getSisterDB("local");
+ var db = this.getSiblingDB("local");
var result = { };
var oplog;
@@ -698,7 +700,7 @@ DB.prototype.printSlaveReplicationInfo = function() {
}
};
- var L = this.getSisterDB("local");
+ var L = this.getSiblingDB("local");
if( L.sources.count() != 0 ) {
L.sources.find().forEach(g);
}
@@ -754,7 +756,7 @@ DB.prototype.listCommands = function(){
}
DB.prototype.printShardingStatus = function(){
- printShardingStatus( this.getSisterDB( "config" ) );
+ printShardingStatus( this.getSiblingDB( "config" ) );
}
DB.autocomplete = function(obj){
View
@@ -1474,10 +1474,12 @@ const StringData _jscode_raw_db =
"return this._mongo;\n"
"}\n"
"\n"
-"DB.prototype.getSisterDB = function( name ){\n"
+"DB.prototype.getSiblingDB = function( name ){\n"
"return this.getMongo().getDB( name );\n"
"}\n"
"\n"
+"DB.prototype.getSisterDB = DB.prototype.getSiblingDB;\n"
+"\n"
"DB.prototype.getName = function(){\n"
"return this._name;\n"
"}\n"
@@ -1511,7 +1513,7 @@ const StringData _jscode_raw_db =
"DB.prototype.adminCommand = function( obj ){\n"
"if ( this._name == \"admin\" )\n"
"return this.runCommand( obj );\n"
-"return this.getSisterDB( \"admin\" ).runCommand( obj );\n"
+"return this.getSiblingDB( \"admin\" ).runCommand( obj );\n"
"}\n"
"\n"
"DB.prototype._adminCommand = DB.prototype.adminCommand; // alias old name\n"
@@ -1751,7 +1753,7 @@ const StringData _jscode_raw_db =
"print(\"\\tdb.getProfilingLevel() - deprecated\");\n"
"print(\"\\tdb.getProfilingStatus() - returns if profiling is on and slow threshold \");\n"
"print(\"\\tdb.getReplicationInfo()\");\n"
-"print(\"\\tdb.getSisterDB(name) get the db at the same server as this one\");\n"
+"print(\"\\tdb.getSiblingDB(name) get the db at the same server as this one\");\n"
"print(\"\\tdb.isMaster() check replica primary status\");\n"
"print(\"\\tdb.killOp(opid) kills the current operation in the db\");\n"
"print(\"\\tdb.listCommands() lists all the db commands\");\n"
@@ -2053,7 +2055,7 @@ const StringData _jscode_raw_db =
"* of date than that, it can't recover without a complete resync\n"
"*/\n"
"DB.prototype.getReplicationInfo = function() {\n"
-"var db = this.getSisterDB(\"local\");\n"
+"var db = this.getSiblingDB(\"local\");\n"
"\n"
"var result = { };\n"
"var oplog;\n"
@@ -2160,7 +2162,7 @@ const StringData _jscode_raw_db =
"}\n"
"};\n"
"\n"
-"var L = this.getSisterDB(\"local\");\n"
+"var L = this.getSiblingDB(\"local\");\n"
"if( L.sources.count() != 0 ) {\n"
"L.sources.find().forEach(g);\n"
"}\n"
@@ -2216,7 +2218,7 @@ const StringData _jscode_raw_db =
"}\n"
"\n"
"DB.prototype.printShardingStatus = function(){\n"
-"printShardingStatus( this.getSisterDB( \"config\" ) );\n"
+"printShardingStatus( this.getSiblingDB( \"config\" ) );\n"
"}\n"
"\n"
"DB.autocomplete = function(obj){\n"

0 comments on commit 1808b56

Please sign in to comment.