summaryrefslogtreecommitdiff
path: root/jstests/sharding/count2.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/count2.js
parenta025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff)
downloadmongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/count2.js')
-rw-r--r--jstests/sharding/count2.js76
1 files changed, 38 insertions, 38 deletions
diff --git a/jstests/sharding/count2.js b/jstests/sharding/count2.js
index cbef67a2db9..8b1346fd0d4 100644
--- a/jstests/sharding/count2.js
+++ b/jstests/sharding/count2.js
@@ -1,56 +1,56 @@
(function() {
-var s1 = new ShardingTest({ name: "count2",
- shards: 2,
- mongos: 2 });
-var s2 = s1._mongos[1];
+ var s1 = new ShardingTest({name: "count2", shards: 2, mongos: 2});
+ var s2 = s1._mongos[1];
-s1.adminCommand( { enablesharding: "test" } );
-s1.ensurePrimaryShard('test', 'shard0001');
-s1.adminCommand( { shardcollection: "test.foo" , key : { name : 1 } } );
+ s1.adminCommand({enablesharding: "test"});
+ s1.ensurePrimaryShard('test', 'shard0001');
+ s1.adminCommand({shardcollection: "test.foo", key: {name: 1}});
-var db1 = s1.getDB( "test" ).foo;
-var db2 = s2.getDB( "test" ).foo;
+ var db1 = s1.getDB("test").foo;
+ var db2 = s2.getDB("test").foo;
-assert.eq( 1, s1.config.chunks.count(), "sanity check A");
+ assert.eq(1, s1.config.chunks.count(), "sanity check A");
-db1.save( { name : "aaa" } );
-db1.save( { name : "bbb" } );
-db1.save( { name : "ccc" } );
-db1.save( { name : "ddd" } );
-db1.save( { name : "eee" } );
-db1.save( { name : "fff" } );
+ db1.save({name: "aaa"});
+ db1.save({name: "bbb"});
+ db1.save({name: "ccc"});
+ db1.save({name: "ddd"});
+ db1.save({name: "eee"});
+ db1.save({name: "fff"});
-s1.adminCommand( { split : "test.foo" , middle : { name : "ddd" } } );
+ s1.adminCommand({split: "test.foo", middle: {name: "ddd"}});
-assert.eq( 3, db1.count( { name : { $gte: "aaa" , $lt: "ddd" } } ) , "initial count mongos1" );
-assert.eq( 3, db2.count( { name : { $gte: "aaa" , $lt: "ddd" } } ) , "initial count mongos2" );
+ assert.eq(3, db1.count({name: {$gte: "aaa", $lt: "ddd"}}), "initial count mongos1");
+ assert.eq(3, db2.count({name: {$gte: "aaa", $lt: "ddd"}}), "initial count mongos2");
-s1.printChunks( "test.foo" );
+ s1.printChunks("test.foo");
-s1.adminCommand( { movechunk : "test.foo",
- find : { name : "aaa" },
- to : s1.getOther( s1.getPrimaryShard( "test" ) ).name,
- _waitForDelete : true });
+ s1.adminCommand({
+ movechunk: "test.foo",
+ find: {name: "aaa"},
+ to: s1.getOther(s1.getPrimaryShard("test")).name,
+ _waitForDelete: true
+ });
-assert.eq( 3, db1.count( { name : { $gte: "aaa" , $lt: "ddd" } } ) , "post count mongos1" );
+ assert.eq(3, db1.count({name: {$gte: "aaa", $lt: "ddd"}}), "post count mongos1");
-// The second mongos still thinks its shard mapping is valid and accepts a cound
-print( "before sleep: " + Date() );
-sleep( 2000 );
-print( "after sleep: " + Date() );
-s1.printChunks( "test.foo" );
-assert.eq( 3, db2.find( { name : { $gte: "aaa" , $lt: "ddd" } } ).count() , "post count mongos2" );
+ // The second mongos still thinks its shard mapping is valid and accepts a cound
+ print("before sleep: " + Date());
+ sleep(2000);
+ print("after sleep: " + Date());
+ s1.printChunks("test.foo");
+ assert.eq(3, db2.find({name: {$gte: "aaa", $lt: "ddd"}}).count(), "post count mongos2");
-db2.findOne();
+ db2.findOne();
-assert.eq( 3, db2.count( { name : { $gte: "aaa" , $lt: "ddd" } } ) );
+ assert.eq(3, db2.count({name: {$gte: "aaa", $lt: "ddd"}}));
-assert.eq( 4, db2.find().limit( 4 ).count( true ));
-assert.eq( 4, db2.find().limit( -4 ).count( true ));
-assert.eq( 6, db2.find().limit( 0 ).count( true ));
-assert.eq( 6, db2.getDB().runCommand({ count: db2.getName(), limit: 0 }).n );
+ assert.eq(4, db2.find().limit(4).count(true));
+ assert.eq(4, db2.find().limit(-4).count(true));
+ assert.eq(6, db2.find().limit(0).count(true));
+ assert.eq(6, db2.getDB().runCommand({count: db2.getName(), limit: 0}).n);
-s1.stop();
+ s1.stop();
})();