summaryrefslogtreecommitdiff
path: root/jstests/sharding/bouncing_count.js
diff options
context:
space:
mode:
authorJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:17:50 -0500
committerJonathan Abrahams <jonathan@mongodb.com>2016-03-09 12:18:14 -0500
commit4ae691e8edc87d0e3cfb633bb91c328426be007b (patch)
tree52079a593f54382ca13a2e741633eab1b6271893 /jstests/sharding/bouncing_count.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/bouncing_count.js')
-rw-r--r--jstests/sharding/bouncing_count.js75
1 files changed, 37 insertions, 38 deletions
diff --git a/jstests/sharding/bouncing_count.js b/jstests/sharding/bouncing_count.js
index d2df8c92984..62ff26c08a7 100644
--- a/jstests/sharding/bouncing_count.js
+++ b/jstests/sharding/bouncing_count.js
@@ -1,58 +1,57 @@
// Tests whether new sharding is detected on insert by mongos
(function() {
-'use strict';
+ 'use strict';
-var st = new ShardingTest({ shards: 10, mongos: 3 });
+ var st = new ShardingTest({shards: 10, mongos: 3});
-var mongosA = st.s0;
-var mongosB = st.s1;
-var mongosC = st.s2;
+ var mongosA = st.s0;
+ var mongosB = st.s1;
+ var mongosC = st.s2;
-var admin = mongosA.getDB("admin");
-var config = mongosA.getDB("config");
+ var admin = mongosA.getDB("admin");
+ var config = mongosA.getDB("config");
-var collA = mongosA.getCollection("foo.bar");
-var collB = mongosB.getCollection("" + collA);
-var collC = mongosB.getCollection("" + collA);
+ var collA = mongosA.getCollection("foo.bar");
+ var collB = mongosB.getCollection("" + collA);
+ var collC = mongosB.getCollection("" + collA);
-var shards = config.shards.find().sort({ _id: 1 }).toArray();
+ var shards = config.shards.find().sort({_id: 1}).toArray();
-assert.commandWorked(admin.runCommand({ enableSharding: "" + collA.getDB() }));
-st.ensurePrimaryShard(collA.getDB().getName(), shards[1]._id);
-assert.commandWorked(admin.runCommand({ shardCollection: "" + collA, key: { _id: 1 } }));
+ assert.commandWorked(admin.runCommand({enableSharding: "" + collA.getDB()}));
+ st.ensurePrimaryShard(collA.getDB().getName(), shards[1]._id);
+ assert.commandWorked(admin.runCommand({shardCollection: "" + collA, key: {_id: 1}}));
-jsTestLog("Splitting up the collection...");
+ jsTestLog("Splitting up the collection...");
-// Split up the collection
-for(var i = 0; i < shards.length; i++){
- assert.commandWorked(admin.runCommand({ split: "" + collA, middle: { _id: i } }));
- assert.commandWorked(
- admin.runCommand({ moveChunk: "" + collA, find: { _id: i }, to: shards[i]._id }));
-}
+ // Split up the collection
+ for (var i = 0; i < shards.length; i++) {
+ assert.commandWorked(admin.runCommand({split: "" + collA, middle: {_id: i}}));
+ assert.commandWorked(
+ admin.runCommand({moveChunk: "" + collA, find: {_id: i}, to: shards[i]._id}));
+ }
-mongosB.getDB("admin").runCommand({ flushRouterConfig: 1 });
-mongosC.getDB("admin").runCommand({ flushRouterConfig: 1 });
+ mongosB.getDB("admin").runCommand({flushRouterConfig: 1});
+ mongosC.getDB("admin").runCommand({flushRouterConfig: 1});
-printjson(collB.count());
-printjson(collC.count());
+ printjson(collB.count());
+ printjson(collC.count());
-// Change up all the versions...
-for(var i = 0; i < shards.length; i++){
- assert.commandWorked(admin.runCommand({ moveChunk: "" + collA,
- find: { _id: i },
- to: shards[ (i + 1) % shards.length ]._id }));
-}
+ // Change up all the versions...
+ for (var i = 0; i < shards.length; i++) {
+ assert.commandWorked(admin.runCommand(
+ {moveChunk: "" + collA, find: {_id: i}, to: shards[(i + 1) % shards.length]._id}));
+ }
-// Make sure mongos A is up-to-date
-mongosA.getDB("admin").runCommand({ flushRouterConfig: 1 });
+ // Make sure mongos A is up-to-date
+ mongosA.getDB("admin").runCommand({flushRouterConfig: 1});
-st.printShardingStatus(true);
+ st.printShardingStatus(true);
-jsTestLog("Running count!");
+ jsTestLog("Running count!");
-printjson(collB.count());
-printjson(collC.find().toArray());
+ printjson(collB.count());
+ printjson(collC.find().toArray());
-st.stop();
+ st.stop();
})();