diff options
author | Pavi Vetriselvan <pavithra.vetriselvan@mongodb.com> | 2020-08-11 11:52:27 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-08-17 16:11:37 +0000 |
commit | e1daee88b3f4ef640e677143d210432e02a8fac2 (patch) | |
tree | 0cf2b8364c2c6743cac12d238aa856c1bc0373d0 | |
parent | 2aaceb6fd0e5fbccbc2183138f37e45847d55cd3 (diff) | |
download | mongo-e1daee88b3f4ef640e677143d210432e02a8fac2.tar.gz |
SERVER-49996 Ensure getSiblingDB() is used instead of getSisterDB()
42 files changed, 130 insertions, 131 deletions
diff --git a/jstests/auth/auth1.js b/jstests/auth/auth1.js index 64ab9d661ce..4498c9acc23 100644 --- a/jstests/auth/auth1.js +++ b/jstests/auth/auth1.js @@ -20,8 +20,8 @@ function runTest(m) { dbRO = mro.getDB("test"); tRO = dbRO[baseName]; - db.getSisterDB("admin").createUser({user: "root", pwd: "root", roles: ["root"]}); - db.getSisterDB("admin").auth("root", "root"); + db.getSiblingDB("admin").createUser({user: "root", pwd: "root", roles: ["root"]}); + db.getSiblingDB("admin").auth("root", "root"); t = db[baseName]; t.drop(); @@ -29,11 +29,11 @@ function runTest(m) { db.dropAllUsers(); db.logout(); - db.getSisterDB("admin").createUser({user: "super", pwd: "super", roles: ["__system"]}); - db.getSisterDB("admin").auth("super", "super"); + db.getSiblingDB("admin").createUser({user: "super", pwd: "super", roles: ["__system"]}); + db.getSiblingDB("admin").auth("super", "super"); db.createUser({user: "eliot", pwd: "eliot", roles: jsTest.basicUserRoles}); db.createUser({user: "guest", pwd: "guest", roles: jsTest.readOnlyUserRoles}); - db.getSisterDB("admin").logout(); + db.getSiblingDB("admin").logout(); assert.throws(function() { t.findOne(); diff --git a/jstests/auth/lib/commands_lib.js b/jstests/auth/lib/commands_lib.js index 253113ee08a..c26c125f81f 100644 --- a/jstests/auth/lib/commands_lib.js +++ b/jstests/auth/lib/commands_lib.js @@ -282,10 +282,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -314,7 +314,7 @@ var authCommandsLib = { }, skipSharded: true, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -350,7 +350,7 @@ var authCommandsLib = { }, skipSharded: true, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -377,7 +377,7 @@ var authCommandsLib = { }, skipSharded: true, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [{ expectAuthzFailure: true, @@ -402,10 +402,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -442,7 +442,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -451,7 +451,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -480,7 +480,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -489,7 +489,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -538,11 +538,11 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(secondDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(secondDbName).y.drop(); }, testcases: [ { @@ -572,10 +572,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -601,7 +601,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -610,7 +610,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -638,7 +638,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -647,7 +647,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -677,7 +677,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); return { @@ -686,7 +686,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -723,10 +723,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -756,15 +756,15 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); - var sibling = db.getSisterDB(firstDbName); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); assert.commandWorked(sibling.runCommand({create: "y"})); return {x_uuid: getUUIDFromListCollections(sibling, sibling.x.getName())}; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -795,15 +795,15 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); - var sibling = db.getSisterDB(firstDbName); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); + var sibling = db.getSiblingDB(firstDbName); assert.commandWorked(sibling.runCommand({create: "x"})); assert.commandWorked(sibling.runCommand({create: "y"})); return {x_uuid: getUUIDFromListCollections(sibling, sibling.x.getName())}; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -832,10 +832,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({_id: 1, data: 1})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({_id: 1, data: 1})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -860,10 +860,10 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({_id: 1, data: 1})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({_id: 1, data: 1})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -891,7 +891,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.writeOK(sibling.x.save({_id: 1, data: 1})); return { @@ -900,7 +900,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -929,7 +929,7 @@ var authCommandsLib = { }, skipSharded: true, setup: function(db) { - var sibling = db.getSisterDB(firstDbName); + var sibling = db.getSiblingDB(firstDbName); assert.writeOK(sibling.x.save({_id: 1, data: 1})); return { @@ -938,7 +938,7 @@ var authCommandsLib = { }; }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -955,10 +955,10 @@ var authCommandsLib = { command: {applyOps: [{"op": "d", "ns": firstDbName + ".x", "o": {"_id": 1}}]}, skipSharded: true, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({_id: 1, data: 1})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({_id: 1, data: 1})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).x.drop(); }, testcases: [ { @@ -4900,11 +4900,11 @@ var authCommandsLib = { testname: "renameCollection_sameDb", command: {renameCollection: firstDbName + ".x", to: firstDbName + ".y", dropTarget: true}, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); }, testcases: [ { @@ -4928,11 +4928,11 @@ var authCommandsLib = { testname: "renameCollection_sameDb_failure", command: {renameCollection: firstDbName + ".x", to: firstDbName + ".y"}, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(firstDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(firstDbName).y.drop(); }, testcases: [ { @@ -4952,20 +4952,20 @@ var authCommandsLib = { testname: "renameCollection_twoDbs", command: {renameCollection: firstDbName + ".x", to: secondDbName + ".y"}, setup: function(db) { - assert.writeOK(db.getSisterDB(firstDbName).x.save({})); + assert.writeOK(db.getSiblingDB(firstDbName).x.save({})); // Running movePrimary is necessary on mongos, but doesn't exist on non-sharded // systems. if (db.getMongo().isMongos()) { assert.commandWorked( - db.getSisterDB(adminDbName).runCommand({movePrimary: firstDbName, to: shard0name})); + db.getSiblingDB(adminDbName).runCommand({movePrimary: firstDbName, to: shard0name})); assert.commandWorked( - db.getSisterDB(adminDbName).runCommand({movePrimary: secondDbName, to: shard0name})); + db.getSiblingDB(adminDbName).runCommand({movePrimary: secondDbName, to: shard0name})); } }, teardown: function(db) { - db.getSisterDB(firstDbName).x.drop(); - db.getSisterDB(secondDbName).y.drop(); + db.getSiblingDB(firstDbName).x.drop(); + db.getSiblingDB(secondDbName).y.drop(); }, testcases: [ { diff --git a/jstests/auth/mr_auth.js b/jstests/auth/mr_auth.js index 1adc66ea7fa..9c398af1ba1 100644 --- a/jstests/auth/mr_auth.js +++ b/jstests/auth/mr_auth.js @@ -32,11 +32,11 @@ for (var i = 0; i < 1000; i++) assert.eq(1000, t.count(), "inserts failed"); d.dropAllUsers(); -d.getSisterDB("admin").createUser({user: "admin", pwd: "admin", roles: jsTest.adminUserRoles}); -d.getSisterDB("admin").auth('admin', 'admin'); +d.getSiblingDB("admin").createUser({user: "admin", pwd: "admin", roles: jsTest.adminUserRoles}); +d.getSiblingDB("admin").auth('admin', 'admin'); d.createUser({user: "write", pwd: "write", roles: jsTest.basicUserRoles}); d.createUser({user: "read", pwd: "read", roles: jsTest.readOnlyUserRoles}); -d.getSisterDB("admin").logout(); +d.getSiblingDB("admin").logout(); t.mapReduce(map, red, {out: {inline: 1}}); diff --git a/jstests/auth/profile.js b/jstests/auth/profile.js index 1b63133edbc..3c88b37ad29 100644 --- a/jstests/auth/profile.js +++ b/jstests/auth/profile.js @@ -2,7 +2,7 @@ // @tags: [requires_profiling] var conn = MongoRunner.runMongod(); var db1 = conn.getDB("profile-a"); -var db2 = db1.getSisterDB("profile-b"); +var db2 = db1.getSiblingDB("profile-b"); var username = "user"; db1.createUser({user: username, pwd: "password", roles: jsTest.basicUserRoles}); db2.createUser({user: username, pwd: "password", roles: jsTest.basicUserRoles}); diff --git a/jstests/auth/user_cache_doc_source.js b/jstests/auth/user_cache_doc_source.js index 90378b18562..a4b57eb66ae 100644 --- a/jstests/auth/user_cache_doc_source.js +++ b/jstests/auth/user_cache_doc_source.js @@ -31,7 +31,7 @@ newConn.close(); */ var awaitShell = startParallelShell(function() { - assert.eq(db.getSisterDB("admin").auth("readOnlyUser", "foobar"), 1); + assert.eq(db.getSiblingDB("admin").auth("readOnlyUser", "foobar"), 1); }, mongod.port); const expectedReadOnlyInactive = [ diff --git a/jstests/core/apitest_db.js b/jstests/core/apitest_db.js index 83746811184..03d82401726 100644 --- a/jstests/core/apitest_db.js +++ b/jstests/core/apitest_db.js @@ -115,5 +115,4 @@ assert.docEq({storageEngine: validStorageEngineOptions}, dd("e"); -assert.eq("foo", db.getSisterDB("foo").getName()); assert.eq("foo", db.getSiblingDB("foo").getName()); diff --git a/jstests/core/bypass_doc_validation.js b/jstests/core/bypass_doc_validation.js index 6016017bfb1..19e70019686 100644 --- a/jstests/core/bypass_doc_validation.js +++ b/jstests/core/bypass_doc_validation.js @@ -108,7 +108,7 @@ function runBypassDocumentValidationTest(validator) { // Test the mapReduce command if it is reading from a different database and collection without // validation. - const otherDb = myDb.getSisterDB("mr_second_input_db"); + const otherDb = myDb.getSiblingDB("mr_second_input_db"); const otherDbColl = otherDb.mr_second_input_coll; assert.commandWorked(otherDbColl.insert({val: 1})); outputColl.drop(); diff --git a/jstests/core/create_collection_fail_cleanup.js b/jstests/core/create_collection_fail_cleanup.js index f422d25bd88..90d636dbd3a 100644 --- a/jstests/core/create_collection_fail_cleanup.js +++ b/jstests/core/create_collection_fail_cleanup.js @@ -6,7 +6,7 @@ load("jstests/libs/fixture_helpers.js"); // For 'isMongos()'. -var dbTest = db.getSisterDB("DB_create_collection_fail_cleanup"); +var dbTest = db.getSiblingDB("DB_create_collection_fail_cleanup"); dbTest.dropDatabase(); let collectionNames = dbTest.getCollectionNames(); diff --git a/jstests/core/create_indexes.js b/jstests/core/create_indexes.js index ae005388d8a..5e3580a1f6a 100644 --- a/jstests/core/create_indexes.js +++ b/jstests/core/create_indexes.js @@ -41,7 +41,7 @@ var checkImplicitCreate = function(createIndexResult) { assert.eq(true, createIndexResult.createdCollectionAutomatically); }; -var dbTest = db.getSisterDB('create_indexes_db'); +var dbTest = db.getSiblingDB('create_indexes_db'); dbTest.dropDatabase(); // Database does not exist diff --git a/jstests/core/dbcase.js b/jstests/core/dbcase.js index bcbb103d873..73b3b34e97a 100644 --- a/jstests/core/dbcase.js +++ b/jstests/core/dbcase.js @@ -1,7 +1,7 @@ // Check db name duplication constraint SERVER-2111 -a = db.getSisterDB("dbcasetest_dbnamea"); -b = db.getSisterDB("dbcasetest_dbnameA"); +a = db.getSiblingDB("dbcasetest_dbnamea"); +b = db.getSiblingDB("dbcasetest_dbnameA"); a.dropDatabase(); b.dropDatabase(); diff --git a/jstests/core/dbcase2.js b/jstests/core/dbcase2.js index 34c0597ab05..1dff55bad6e 100644 --- a/jstests/core/dbcase2.js +++ b/jstests/core/dbcase2.js @@ -1,8 +1,8 @@ // SERVER-2111 Check that an in memory db name will block creation of a db with a similar but // differently cased name. -var dbLowerCase = db.getSisterDB("dbcase2test_dbnamea"); -var dbUpperCase = db.getSisterDB("dbcase2test_dbnameA"); +var dbLowerCase = db.getSiblingDB("dbcase2test_dbnamea"); +var dbUpperCase = db.getSiblingDB("dbcase2test_dbnameA"); var resultLower = dbLowerCase.c.insert({}); assert.eq(1, resultLower.nInserted); diff --git a/jstests/core/dbhash.js b/jstests/core/dbhash.js index eeddce74a75..47143e7d9b4 100644 --- a/jstests/core/dbhash.js +++ b/jstests/core/dbhash.js @@ -45,8 +45,8 @@ assert.neq(gh(a), gh(b), "A2"); b.insert({_id: 5}); assert.eq(gh(a), gh(b), "A3"); -dba = db.getSisterDB("dbhasha"); -dbb = db.getSisterDB("dbhashb"); +dba = db.getSiblingDB("dbhasha"); +dbb = db.getSiblingDB("dbhashb"); dba.dropDatabase(); dbb.dropDatabase(); diff --git a/jstests/core/dbhash2.js b/jstests/core/dbhash2.js index 39860cc225b..f62025b382e 100644 --- a/jstests/core/dbhash2.js +++ b/jstests/core/dbhash2.js @@ -4,7 +4,7 @@ // incompatible_with_embedded, // ] -mydb = db.getSisterDB("config"); +mydb = db.getSiblingDB("config"); t = mydb.foo; t.drop(); diff --git a/jstests/core/delx.js b/jstests/core/delx.js index a5b95d04f0e..331f6a18b67 100644 --- a/jstests/core/delx.js +++ b/jstests/core/delx.js @@ -1,7 +1,7 @@ // @tags: [assumes_against_mongod_not_mongos, requires_getmore, requires_non_retryable_writes] -a = db.getSisterDB("delxa"); -b = db.getSisterDB("delxb"); +a = db.getSiblingDB("delxa"); +b = db.getSiblingDB("delxb"); function setup(mydb) { mydb.dropDatabase(); diff --git a/jstests/core/dropdb.js b/jstests/core/dropdb.js index 1fd3fd10582..bf3c5d18b34 100644 --- a/jstests/core/dropdb.js +++ b/jstests/core/dropdb.js @@ -4,7 +4,7 @@ m = db.getMongo(); baseName = "jstests_dropdb"; -ddb = db.getSisterDB(baseName); +ddb = db.getSiblingDB(baseName); print("initial dbs: " + tojson(m.getDBNames())); diff --git a/jstests/core/dropdb_race.js b/jstests/core/dropdb_race.js index 8ec97188639..6bcd334e7ab 100644 --- a/jstests/core/dropdb_race.js +++ b/jstests/core/dropdb_race.js @@ -8,7 +8,7 @@ m = db.getMongo(); baseName = "jstests_dur_droprace"; -d = db.getSisterDB(baseName); +d = db.getSiblingDB(baseName); t = d.foo; assert(d.adminCommand({setParameter: 1, syncdelay: 5}).ok); diff --git a/jstests/core/fsync.js b/jstests/core/fsync.js index 2c721af08e9..77b247ff1f1 100644 --- a/jstests/core/fsync.js +++ b/jstests/core/fsync.js @@ -16,7 +16,7 @@ "use strict"; // Start with a clean DB. -var fsyncLockDB = db.getSisterDB('fsyncLockTestDB'); +var fsyncLockDB = db.getSiblingDB('fsyncLockTestDB'); fsyncLockDB.dropDatabase(); // Tests the db.fsyncLock/fsyncUnlock features. @@ -36,7 +36,7 @@ db.fsyncUnlock(); var resFail = fsyncLockDB.runCommand({fsync: 1, lock: 1}); // Start with a clean DB -var fsyncLockDB = db.getSisterDB('fsyncLockTestDB'); +var fsyncLockDB = db.getSiblingDB('fsyncLockTestDB'); fsyncLockDB.dropDatabase(); // Test that a single, regular write works as expected. @@ -54,7 +54,7 @@ assert(db.currentOp().fsyncLock, "Value in db.currentOp incorrect for fsyncLocke // Make sure writes are blocked. Spawn a write operation in a separate shell and make sure it // is blocked. There is really no way to do that currently, so just check that the write didn't // go through. -var writeOpHandle = startParallelShell("db.getSisterDB('fsyncLockTestDB').coll.insert({x:1});"); +var writeOpHandle = startParallelShell("db.getSiblingDB('fsyncLockTestDB').coll.insert({x:1});"); sleep(3000); // Make sure reads can still run even though there is a pending write and also that the write @@ -90,7 +90,7 @@ assert.commandWorked(currentOp); assert(currentOp.fsyncLock, "Value in db.currentOp incorrect for fsyncLocked server"); let shellHandle1 = - startParallelShell("db.getSisterDB('fsyncLockTestDB').multipleLock.insert({x:1});"); + startParallelShell("db.getSiblingDB('fsyncLockTestDB').multipleLock.insert({x:1});"); fsyncLockRes = db.fsyncLock(); assert.commandWorked(fsyncLockRes); @@ -100,7 +100,7 @@ assert.commandWorked(currentOp); assert(currentOp.fsyncLock, "Value in db.currentOp incorrect for fsyncLocked server"); let shellHandle2 = - startParallelShell("db.getSisterDB('fsyncLockTestDB').multipleLock.insert({x:1});"); + startParallelShell("db.getSiblingDB('fsyncLockTestDB').multipleLock.insert({x:1});"); sleep(3000); assert.eq(0, fsyncLockDB.multipleLock.find({}).itcount()); diff --git a/jstests/core/list_all_local_sessions.js b/jstests/core/list_all_local_sessions.js index 72226dfbb08..434e8ed660c 100644 --- a/jstests/core/list_all_local_sessions.js +++ b/jstests/core/list_all_local_sessions.js @@ -13,7 +13,7 @@ (function() { 'use strict'; -const admin = db.getSisterDB('admin'); +const admin = db.getSiblingDB('admin'); // Get current log level. let originalLogLevel = assert.commandWorked(admin.setLogLevel(1)).was.verbosity; diff --git a/jstests/core/list_local_sessions.js b/jstests/core/list_local_sessions.js index c1ba5799c96..bee5c084ca7 100644 --- a/jstests/core/list_local_sessions.js +++ b/jstests/core/list_local_sessions.js @@ -13,7 +13,7 @@ (function() { 'use strict'; -const admin = db.getSisterDB('admin'); +const admin = db.getSiblingDB('admin'); function listLocalSessions() { return admin.aggregate([{'$listLocalSessions': {allUsers: false}}]); } diff --git a/jstests/core/loadserverscripts.js b/jstests/core/loadserverscripts.js index 641a07245fe..8e491a8fc7c 100644 --- a/jstests/core/loadserverscripts.js +++ b/jstests/core/loadserverscripts.js @@ -7,7 +7,7 @@ // Test db.loadServerScripts() -var testdb = db.getSisterDB("loadserverscripts"); +var testdb = db.getSiblingDB("loadserverscripts"); jsTest.log("testing db.loadServerScripts()"); var x; @@ -52,7 +52,7 @@ assert.eq(x, "myfunc", "Checking that myfunc() returns the correct value"); // Insert value into collection from another process var coproc = - startParallelShell('db.getSisterDB("loadserverscripts").system.js.insert' + + startParallelShell('db.getSiblingDB("loadserverscripts").system.js.insert' + ' ( {_id: "myfunc2", "value": function(){ return "myfunc2"; } } );'); // wait for results coproc(); diff --git a/jstests/core/profile1.js b/jstests/core/profile1.js index 6fce5d9e74c..9d85a1e6788 100644 --- a/jstests/core/profile1.js +++ b/jstests/core/profile1.js @@ -33,7 +33,7 @@ function resetProfile(level, slowms) { // special db so that it can be run in parallel tests var stddb = db; -db = db.getSisterDB("profile1"); +db = db.getSiblingDB("profile1"); var username = "jstests_profile1_user"; db.dropUser(username); diff --git a/jstests/core/profile2.js b/jstests/core/profile2.js index d58fe533dd9..002a1ebc184 100644 --- a/jstests/core/profile2.js +++ b/jstests/core/profile2.js @@ -6,7 +6,7 @@ // sbe_incompatible, // ] -var coll = db.getSisterDB("profile2").profile2; +var coll = db.getSiblingDB("profile2").profile2; assert.commandWorked(coll.getDB().runCommand({profile: 0})); coll.drop(); diff --git a/jstests/core/profile3.js b/jstests/core/profile3.js index 5dc23bdac8b..08340991f77 100644 --- a/jstests/core/profile3.js +++ b/jstests/core/profile3.js @@ -6,7 +6,7 @@ // ] // special db so that it can be run in parallel tests var stddb = db; -var db = db.getSisterDB("profile3"); +var db = db.getSiblingDB("profile3"); db.dropAllUsers(); t = db.profile3; diff --git a/jstests/core/profile_sampling.js b/jstests/core/profile_sampling.js index 2239914cf34..78c6f182759 100644 --- a/jstests/core/profile_sampling.js +++ b/jstests/core/profile_sampling.js @@ -9,7 +9,7 @@ "use strict"; // Use a special db to support running other tests in parallel. -const profileDB = db.getSisterDB("profile_sampling"); +const profileDB = db.getSiblingDB("profile_sampling"); const coll = profileDB.profile_sampling; profileDB.dropDatabase(); diff --git a/jstests/core/startup_log.js b/jstests/core/startup_log.js index 0da9f636a3b..6f13bada629 100644 --- a/jstests/core/startup_log.js +++ b/jstests/core/startup_log.js @@ -29,11 +29,11 @@ function arrayIsSubset(smallArray, largeArray) { } // Test startup_log -var stats = db.getSisterDB("local").startup_log.stats(); +var stats = db.getSiblingDB("local").startup_log.stats(); assert(stats.capped); var latestStartUpLog = - db.getSisterDB("local").startup_log.find().sort({$natural: -1}).limit(1).next(); + db.getSiblingDB("local").startup_log.find().sort({$natural: -1}).limit(1).next(); var serverStatus = db._adminCommand("serverStatus"); var cmdLine = db._adminCommand("getCmdLineOpts").parsed; diff --git a/jstests/core/storefunc.js b/jstests/core/storefunc.js index 8f6eca7a574..4b301d64762 100644 --- a/jstests/core/storefunc.js +++ b/jstests/core/storefunc.js @@ -5,7 +5,7 @@ // ] // Use a private sister database to avoid conflicts with other tests that use system.js -var testdb = db.getSisterDB("storefunc"); +var testdb = db.getSiblingDB("storefunc"); var res; s = testdb.system.js; diff --git a/jstests/core/validate_user_documents.js b/jstests/core/validate_user_documents.js index 3ab4ef1e1fd..9e32cc2dd59 100644 --- a/jstests/core/validate_user_documents.js +++ b/jstests/core/validate_user_documents.js @@ -8,7 +8,7 @@ // Ensure that inserts and updates of the system.users collection validate the schema of inserted // documents. -mydb = db.getSisterDB("validate_user_documents"); +mydb = db.getSiblingDB("validate_user_documents"); function assertGLEOK(status) { assert(status.ok && status.err === null, "Expected OK status object; found " + tojson(status)); diff --git a/jstests/multiVersion/libs/multi_rs.js b/jstests/multiVersion/libs/multi_rs.js index 82aaf083612..6c19c08d371 100644 --- a/jstests/multiVersion/libs/multi_rs.js +++ b/jstests/multiVersion/libs/multi_rs.js @@ -167,7 +167,7 @@ ReplSetTest.prototype.conf = function() { return resp.config; else if (resp.errmsg && resp.errmsg.startsWith("no such cmd")) - return admin.getSisterDB("local").system.replset.findOne(); + return admin.getSiblingDB("local").system.replset.findOne(); throw new Error("Could not retrieve replica set config: " + tojson(resp)); }; diff --git a/jstests/noPassthroughWithMongod/mapreduce_intermediate_reduce.js b/jstests/noPassthroughWithMongod/mapreduce_intermediate_reduce.js index e2bd18146e4..f45e39528fb 100644 --- a/jstests/noPassthroughWithMongod/mapreduce_intermediate_reduce.js +++ b/jstests/noPassthroughWithMongod/mapreduce_intermediate_reduce.js @@ -9,7 +9,7 @@ function assertGLEOK(status) { assert(status.ok && status.err === null, "Expected OK status object; found " + tojson(status)); } -db = db.getSisterDB("MapReduceTestDB"); +db = db.getSiblingDB("MapReduceTestDB"); db.dropDatabase(); var coll = db.getCollection("mrInput"); diff --git a/jstests/noPassthroughWithMongod/no_balance_collection.js b/jstests/noPassthroughWithMongod/no_balance_collection.js index 6549126a9dc..38182f1c481 100644 --- a/jstests/noPassthroughWithMongod/no_balance_collection.js +++ b/jstests/noPassthroughWithMongod/no_balance_collection.js @@ -27,7 +27,7 @@ for (var i = 0; i < 10 - 1; i++) { // 10 chunks total sh.disableBalancing(collB); jsTest.log("Balancing disabled on " + collB); -printjson(collA.getDB().getSisterDB("config").collections.find().toArray()); +printjson(collA.getDB().getSiblingDB("config").collections.find().toArray()); st.startBalancer(); diff --git a/jstests/parallel/del.js b/jstests/parallel/del.js index 903bb983d1f..1a2c74db4a1 100644 --- a/jstests/parallel/del.js +++ b/jstests/parallel/del.js @@ -3,8 +3,8 @@ load('jstests/libs/parallelTester.js'); N = 1000; HOST = db.getMongo().host; -a = db.getSisterDB("fooa"); -b = db.getSisterDB("foob"); +a = db.getSiblingDB("fooa"); +b = db.getSiblingDB("foob"); a.dropDatabase(); b.dropDatabase(); diff --git a/jstests/replsets/maintenance.js b/jstests/replsets/maintenance.js index 77934123e68..5ad4bd55620 100644 --- a/jstests/replsets/maintenance.js +++ b/jstests/replsets/maintenance.js @@ -24,7 +24,7 @@ assert.soon(function() { }); join = - startParallelShell("db.getSisterDB('bar').runCommand({compact : 'foo'});", replTest.ports[1]); + startParallelShell("db.getSiblingDB('bar').runCommand({compact : 'foo'});", replTest.ports[1]); print("joining"); join(); diff --git a/jstests/replsets/replset5.js b/jstests/replsets/replset5.js index 477ced5307f..551f8e7ee94 100644 --- a/jstests/replsets/replset5.js +++ b/jstests/replsets/replset5.js @@ -77,7 +77,7 @@ config.members[2].hidden = 1; master = reconfig(replTest, config); -config = master.getSisterDB("local").system.replset.findOne(); +config = master.getSiblingDB("local").system.replset.findOne(); assert.eq(config.members[2].hidden, true); replTest.stopSet(); diff --git a/jstests/replsets/rollback_ddl_op_sequences.js b/jstests/replsets/rollback_ddl_op_sequences.js index cfb75ea109e..bf9a02995be 100644 --- a/jstests/replsets/rollback_ddl_op_sequences.js +++ b/jstests/replsets/rollback_ddl_op_sequences.js @@ -125,7 +125,7 @@ assert(b.fooname.find().itcount() > 0, "count rename"); // create an index - verify that it is removed b.fooname.ensureIndex({q: 1}); // test roll back (drop) a whole database -var abc = b.getSisterDB("abc"); +var abc = b.getSiblingDB("abc"); assert.commandWorked(abc.foo.insert({x: 1})); assert.commandWorked(abc.bar.insert({y: 999})); diff --git a/jstests/replsets/rslib.js b/jstests/replsets/rslib.js index 1959a86e65e..65567450c96 100644 --- a/jstests/replsets/rslib.js +++ b/jstests/replsets/rslib.js @@ -172,7 +172,7 @@ waitForAllMembers = function(master, timeout) { assert.soon(function() { var state = null; try { - state = master.getSisterDB("admin").runCommand({replSetGetStatus: 1}); + state = master.getSiblingDB("admin").runCommand({replSetGetStatus: 1}); failCount = 0; } catch (e) { // Connection can get reset on replica set failover causing a socket exception diff --git a/jstests/replsets/server8070.js b/jstests/replsets/server8070.js index 1deb3fe49c4..876a768fd7a 100644 --- a/jstests/replsets/server8070.js +++ b/jstests/replsets/server8070.js @@ -12,8 +12,8 @@ load("jstests/replsets/rslib.js"); // helper to ensure two nodes are at the same place in the oplog var waitForSameOplogPosition = function(db1, db2, errmsg) { assert.soon(function() { - var last1 = db1.getSisterDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); - var last2 = db2.getSisterDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); + var last1 = db1.getSiblingDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); + var last2 = db2.getSiblingDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); jsTest.log("primary: " + tojson(last1) + " secondary: " + tojson(last2)); return ((last1.ts.t === last2.ts.t) && (last1.ts.i === last2.ts.i)); @@ -89,7 +89,7 @@ for (var i = 50; i < 75; i++) { } var primaryCollectionSize = primary.bar.find().itcount(); jsTest.log("primary collection size: " + primaryCollectionSize); -var last = primary.getSisterDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); +var last = primary.getSiblingDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); jsTest.log("waiting a bit for the secondaries to get the write"); sleep(10000); @@ -111,7 +111,7 @@ stopServerReplication(member3.getMongo()); // count documents in member 3 assert.eq(26, - member3.getSisterDB("foo").bar.find().itcount(), + member3.getSiblingDB("foo").bar.find().itcount(), "collection size incorrect on node 3 before applying ops 25-75"); jsTest.log("Allow 3 to apply ops 25-75"); @@ -119,11 +119,11 @@ assert.commandWorked(member3.runCommand({configureFailPoint: 'rsSyncApplyStop', "member 3 rsSyncApplyStop admin command failed"); assert.soon(function() { - var last3 = member3.getSisterDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); + var last3 = member3.getSiblingDB("local").oplog.rs.find().sort({$natural: -1}).limit(1).next(); jsTest.log("primary: " + tojson(last, '', true) + " secondary: " + tojson(last3, '', true)); - jsTest.log("member 3 collection size: " + member3.getSisterDB("foo").bar.find().itcount()); + jsTest.log("member 3 collection size: " + member3.getSiblingDB("foo").bar.find().itcount()); jsTest.log("curop: "); - printjson(member3.getSisterDB("foo").currentOp(true)); + printjson(member3.getSiblingDB("foo").currentOp(true)); return ((last.ts.t === last3.ts.t) && (last.ts.i === last3.ts.i)); }, "Replication member 3 did not apply ops 25-75"); diff --git a/jstests/replsets/slavedelay1.js b/jstests/replsets/slavedelay1.js index 770c2430fdd..0d3622bd7c7 100644 --- a/jstests/replsets/slavedelay1.js +++ b/jstests/replsets/slavedelay1.js @@ -52,7 +52,7 @@ doTest = function(signal) { // how about if we add a new server? will it sync correctly? conn = replTest.add(); - config = master.getSisterDB("local").system.replset.findOne(); + config = master.getSiblingDB("local").system.replset.findOne(); printjson(config); config.version++; config.members.push({ @@ -63,7 +63,7 @@ doTest = function(signal) { }); master = reconfig(replTest, config); - master = master.getSisterDB(name); + master = master.getSiblingDB(name); assert.commandWorked(master.foo.insert( {_id: 123, x: 'foo'}, {writeConcern: {w: 2, wtimeout: ReplSetTest.kDefaultTimeoutMS}})); diff --git a/jstests/sharding/features3.js b/jstests/sharding/features3.js index 6ec52f57015..365334b1dc6 100644 --- a/jstests/sharding/features3.js +++ b/jstests/sharding/features3.js @@ -109,7 +109,7 @@ assert.soon(function() { curOpState = 1; // kill all $where mine.forEach(function(z) { - printjson(dbForTest.getSisterDB("admin").killOp(z.opid)); + printjson(dbForTest.getSiblingDB("admin").killOp(z.opid)); }); killTime = new Date(); } diff --git a/jstests/slow1/conc_update.js b/jstests/slow1/conc_update.js index 34398d91f3f..80adb4955e4 100644 --- a/jstests/slow1/conc_update.js +++ b/jstests/slow1/conc_update.js @@ -21,7 +21,7 @@ db.conc.ensureIndex({x: 1}); var c1 = db.conc.count({x: {$lt: NRECORDS}}); const updater = startParallelShell( - "db = db.getSisterDB('concurrency');\ + "db = db.getSiblingDB('concurrency');\ db.concflag.insert({ inprog: true });\ sleep(20);\ assert.commandWorked(db.conc.update({}, \ diff --git a/jstests/ssl/ssl_without_ca.js b/jstests/ssl/ssl_without_ca.js index 4b1cd8d178d..ef3f64949aa 100644 --- a/jstests/ssl/ssl_without_ca.js +++ b/jstests/ssl/ssl_without_ca.js @@ -26,7 +26,7 @@ var exitStatus = runMongoProgram('mongo', '--port', conn.port, '--eval', - ('quit(db.getSisterDB("$external").auth({' + + ('quit(db.getSiblingDB("$external").auth({' + 'user: "' + CLIENT_USER + '" ,' + 'mechanism: "MONGODB-X509"}));')); diff --git a/src/mongo/shell/utils.js b/src/mongo/shell/utils.js index b8f78c28644..b84250ad598 100644 --- a/src/mongo/shell/utils.js +++ b/src/mongo/shell/utils.js @@ -1536,7 +1536,7 @@ rs.add = function(hostport, arb) { assert.soon(function() { var cfg = hostport; - var local = db.getSisterDB("local"); + var local = db.getSiblingDB("local"); assert(local.system.replset.count() <= 1, "error: local.system.replset has unexpected contents"); var c = local.system.replset.findOne(); @@ -1612,13 +1612,13 @@ rs.conf = function() { if (resp.ok && !(resp.errmsg) && resp.config) return resp.config; else if (resp.errmsg && resp.errmsg.startsWith("no such cmd")) - return db.getSisterDB("local").system.replset.findOne(); + return db.getSiblingDB("local").system.replset.findOne(); throw new Error("Could not retrieve replica set config: " + tojson(resp)); }; rs.config = rs.conf; rs.remove = function(hn) { - var local = db.getSisterDB("local"); + var local = db.getSiblingDB("local"); assert(local.system.replset.count() <= 1, "error: local.system.replset has unexpected contents"); var c = local.system.replset.findOne(); @@ -1661,7 +1661,7 @@ rs.debug.nullLastOpWritten = function(primary, secondary) { }; rs.debug.getLastOpWritten = function(server) { - var s = db.getSisterDB("local"); + var s = db.getSiblingDB("local"); if (server) { s = connect(server + "/local"); } diff --git a/src/mongo/shell/utils_sh.js b/src/mongo/shell/utils_sh.js index d60fe31c7c2..a81d4c8b303 100644 --- a/src/mongo/shell/utils_sh.js +++ b/src/mongo/shell/utils_sh.js @@ -16,7 +16,7 @@ sh._checkFullName = function(fullName) { sh._adminCommand = function(cmd, skipCheck) { if (!skipCheck) sh._checkMongos(); - return db.getSisterDB("admin").runCommand(cmd); + return db.getSiblingDB("admin").runCommand(cmd); }; sh._getConfigDB = function() { @@ -276,7 +276,7 @@ sh.disableBalancing = function(coll) { sh._checkMongos(); } - return assert.commandWorked(dbase.getSisterDB("config").collections.update( + return assert.commandWorked(dbase.getSiblingDB("config").collections.update( {_id: coll + ""}, {$set: {"noBalance": true}}, {writeConcern: {w: 'majority', wtimeout: 60000}})); @@ -293,7 +293,7 @@ sh.enableBalancing = function(coll) { sh._checkMongos(); } - return assert.commandWorked(dbase.getSisterDB("config").collections.update( + return assert.commandWorked(dbase.getSiblingDB("config").collections.update( {_id: coll + ""}, {$set: {"noBalance": false}}, {writeConcern: {w: 'majority', wtimeout: 60000}})); @@ -309,13 +309,13 @@ sh._lastMigration = function(ns) { var config = null; if (!ns) { - config = db.getSisterDB("config"); + config = db.getSiblingDB("config"); } else if (ns instanceof DBCollection) { coll = ns; - config = coll.getDB().getSisterDB("config"); + config = coll.getDB().getSiblingDB("config"); } else if (ns instanceof DB) { dbase = ns; - config = dbase.getSisterDB("config"); + config = dbase.getSiblingDB("config"); } else if (ns instanceof ShardingTest) { config = ns.s.getDB("config"); } else if (ns instanceof Mongo) { @@ -324,11 +324,11 @@ sh._lastMigration = function(ns) { // String namespace ns = ns + ""; if (ns.indexOf(".") > 0) { - config = db.getSisterDB("config"); + config = db.getSiblingDB("config"); coll = db.getMongo().getCollection(ns); } else { - config = db.getSisterDB("config"); - dbase = db.getSisterDB(ns); + config = db.getSiblingDB("config"); + dbase = db.getSiblingDB(ns); } } @@ -554,7 +554,7 @@ function printShardingStatus(configDB, verbose) { // configDB is a DB object that contains the sharding metadata of interest. // Defaults to the db named "config" on the current connection. if (configDB === undefined) - configDB = db.getSisterDB('config'); + configDB = db.getSiblingDB('config'); var version = configDB.getCollection("version").findOne(); if (version == null) { @@ -785,7 +785,7 @@ function printShardingSizes(configDB) { // configDB is a DB object that contains the sharding metadata of interest. // Defaults to the db named "config" on the current connection. if (configDB === undefined) - configDB = db.getSisterDB('config'); + configDB = db.getSiblingDB('config'); var version = configDB.getCollection("version").findOne(); if (version == null) { |