diff options
Diffstat (limited to 'jstests/sharding/hash_shard_unique_compound.js')
-rw-r--r-- | jstests/sharding/hash_shard_unique_compound.js | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/jstests/sharding/hash_shard_unique_compound.js b/jstests/sharding/hash_shard_unique_compound.js index eab3fd92c6c..5d6d466c1f9 100644 --- a/jstests/sharding/hash_shard_unique_compound.js +++ b/jstests/sharding/hash_shard_unique_compound.js @@ -3,26 +3,26 @@ // 1.) shard collection on hashed "a", ensure unique index {a:1, b:1} // 2.) reverse order -var s = new ShardingTest( { name : jsTestName() , shards : 1 , mongos : 1, verbose : 1 } ); +var s = new ShardingTest({name: jsTestName(), shards: 1, mongos: 1, verbose: 1}); var dbName = "test"; var collName = "foo"; var ns = dbName + "." + collName; -var db = s.getDB( dbName ); -var coll = db.getCollection( collName ); +var db = s.getDB(dbName); +var coll = db.getCollection(collName); // Enable sharding on DB -var res = db.adminCommand( { enablesharding : dbName } ); +var res = db.adminCommand({enablesharding: dbName}); // for simplicity start by turning off balancer var res = s.stopBalancer(); // shard a fresh collection using a hashed shard key coll.drop(); -assert.commandWorked(db.adminCommand( { shardcollection : ns , key : { a : "hashed" } } )); +assert.commandWorked(db.adminCommand({shardcollection: ns, key: {a: "hashed"}})); db.printShardingStatus(); // Create unique index -assert.commandWorked(coll.ensureIndex({ a: 1, b: 1 }, { unique: true })); +assert.commandWorked(coll.ensureIndex({a: 1, b: 1}, {unique: true})); jsTest.log("------ indexes -------"); jsTest.log(tojson(coll.getIndexes())); @@ -31,11 +31,11 @@ jsTest.log(tojson(coll.getIndexes())); jsTest.log("------ dropping sharded collection to start part 2 -------"); coll.drop(); -//Create unique index -assert.commandWorked(coll.ensureIndex({ a: 1, b: 1 }, { unique: true })); +// Create unique index +assert.commandWorked(coll.ensureIndex({a: 1, b: 1}, {unique: true})); // shard a fresh collection using a hashed shard key -assert.commandWorked(db.adminCommand( { shardcollection : ns , key : { a : "hashed" } } ), +assert.commandWorked(db.adminCommand({shardcollection: ns, key: {a: "hashed"}}), "shardcollection didn't worked 2"); db.printShardingStatus(); |