diff options
author | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:17:50 -0500 |
---|---|---|
committer | Jonathan Abrahams <jonathan@mongodb.com> | 2016-03-09 12:18:14 -0500 |
commit | 4ae691e8edc87d0e3cfb633bb91c328426be007b (patch) | |
tree | 52079a593f54382ca13a2e741633eab1b6271893 /jstests/sharding/shard_keycount.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/shard_keycount.js')
-rw-r--r-- | jstests/sharding/shard_keycount.js | 60 |
1 files changed, 28 insertions, 32 deletions
diff --git a/jstests/sharding/shard_keycount.js b/jstests/sharding/shard_keycount.js index 0524a210918..9a63a2cfdce 100644 --- a/jstests/sharding/shard_keycount.js +++ b/jstests/sharding/shard_keycount.js @@ -1,50 +1,46 @@ // Tests splitting a chunk twice (function() { -var s = new ShardingTest({ name: "shard_keycount", - shards: 2, - mongos: 1, - other:{ chunkSize: 1 } }); + var s = new ShardingTest({name: "shard_keycount", shards: 2, mongos: 1, other: {chunkSize: 1}}); -dbName = "test"; -collName = "foo"; -ns = dbName + "." + collName; - -db = s.getDB( dbName ); + dbName = "test"; + collName = "foo"; + ns = dbName + "." + collName; -for(var i = 0; i < 10; i++){ - db.foo.insert({ _id : i }); -} + db = s.getDB(dbName); -// Enable sharding on DB -s.adminCommand( { enablesharding : dbName } ); -s.ensurePrimaryShard(dbName, 'shard0001'); + for (var i = 0; i < 10; i++) { + db.foo.insert({_id: i}); + } -// Enable sharding on collection -s.adminCommand( { shardcollection : ns, key : { _id : 1 } } ); + // Enable sharding on DB + s.adminCommand({enablesharding: dbName}); + s.ensurePrimaryShard(dbName, 'shard0001'); + // Enable sharding on collection + s.adminCommand({shardcollection: ns, key: {_id: 1}}); -// Split into two chunks -s.adminCommand({ split : ns, find : { _id : 3 } }); + // Split into two chunks + s.adminCommand({split: ns, find: {_id: 3}}); -coll = db.getCollection( collName ); + coll = db.getCollection(collName); -// Split chunk again -s.adminCommand({ split : ns, find : { _id : 3 } }); + // Split chunk again + s.adminCommand({split: ns, find: {_id: 3}}); -coll.update({ _id : 3 }, { _id : 3 }); + coll.update({_id: 3}, {_id: 3}); -// Split chunk again -s.adminCommand({ split : ns, find : { _id : 3 } }); + // Split chunk again + s.adminCommand({split: ns, find: {_id: 3}}); -coll.update({ _id : 3 }, { _id : 3 }); + coll.update({_id: 3}, {_id: 3}); -// Split chunk again -// FAILS since the key count is based on the full index, not the chunk itself -// i.e. Split point calc'd is 5 key offset (10 documents), but only four docs -// in chunk with bounds _id : 0 => 5 -s.adminCommand({ split : ns, find : { _id : 3 } }); + // Split chunk again + // FAILS since the key count is based on the full index, not the chunk itself + // i.e. Split point calc'd is 5 key offset (10 documents), but only four docs + // in chunk with bounds _id : 0 => 5 + s.adminCommand({split: ns, find: {_id: 3}}); -s.stop(); + s.stop(); }); |