diff options
author | clang-format-7.0.1 <adam.martin@10gen.com> | 2019-07-26 18:20:35 -0400 |
---|---|---|
committer | ADAM David Alan Martin <adam.martin@10gen.com> | 2019-07-27 11:02:23 -0400 |
commit | 134a4083953270e8a11430395357fb70a29047ad (patch) | |
tree | dd428e1230e31d92b20b393dfdc17ffe7fa79cb6 /jstests/aggregation/bugs/server6179.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/aggregation/bugs/server6179.js')
-rw-r--r-- | jstests/aggregation/bugs/server6179.js | 98 |
1 files changed, 49 insertions, 49 deletions
diff --git a/jstests/aggregation/bugs/server6179.js b/jstests/aggregation/bugs/server6179.js index a5e934a9e89..065f5b261ee 100644 --- a/jstests/aggregation/bugs/server6179.js +++ b/jstests/aggregation/bugs/server6179.js @@ -4,53 +4,53 @@ // requires_spawning_own_processes, // ] (function() { - 'use strict'; - - var s = new ShardingTest({shards: 2}); - - assert.commandWorked(s.s0.adminCommand({enablesharding: "test"})); - s.ensurePrimaryShard('test', s.shard1.shardName); - assert.commandWorked(s.s0.adminCommand({shardcollection: "test.data", key: {_id: 1}})); - - var d = s.getDB("test"); - - // Insert _id values 0 - 99 - var N = 100; - - var bulkOp = d.data.initializeOrderedBulkOp(); - for (var i = 0; i < N; ++i) { - bulkOp.insert({_id: i, i: i % 10}); - } - bulkOp.execute(); - - // Split the data into 3 chunks - assert.commandWorked(s.s0.adminCommand({split: "test.data", middle: {_id: 33}})); - assert.commandWorked(s.s0.adminCommand({split: "test.data", middle: {_id: 66}})); - - // Migrate the middle chunk to another shard - assert.commandWorked(s.s0.adminCommand( - {movechunk: "test.data", find: {_id: 50}, to: s.getOther(s.getPrimaryShard("test")).name})); - - // Check that we get results rather than an error - var result = d.data - .aggregate({$group: {_id: '$_id', i: {$first: '$i'}}}, - {$group: {_id: '$i', avg_id: {$avg: '$_id'}}}, - {$sort: {_id: 1}}) - .toArray(); - var expected = [ - {"_id": 0, "avg_id": 45}, - {"_id": 1, "avg_id": 46}, - {"_id": 2, "avg_id": 47}, - {"_id": 3, "avg_id": 48}, - {"_id": 4, "avg_id": 49}, - {"_id": 5, "avg_id": 50}, - {"_id": 6, "avg_id": 51}, - {"_id": 7, "avg_id": 52}, - {"_id": 8, "avg_id": 53}, - {"_id": 9, "avg_id": 54} - ]; - - assert.eq(result, expected); - - s.stop(); +'use strict'; + +var s = new ShardingTest({shards: 2}); + +assert.commandWorked(s.s0.adminCommand({enablesharding: "test"})); +s.ensurePrimaryShard('test', s.shard1.shardName); +assert.commandWorked(s.s0.adminCommand({shardcollection: "test.data", key: {_id: 1}})); + +var d = s.getDB("test"); + +// Insert _id values 0 - 99 +var N = 100; + +var bulkOp = d.data.initializeOrderedBulkOp(); +for (var i = 0; i < N; ++i) { + bulkOp.insert({_id: i, i: i % 10}); +} +bulkOp.execute(); + +// Split the data into 3 chunks +assert.commandWorked(s.s0.adminCommand({split: "test.data", middle: {_id: 33}})); +assert.commandWorked(s.s0.adminCommand({split: "test.data", middle: {_id: 66}})); + +// Migrate the middle chunk to another shard +assert.commandWorked(s.s0.adminCommand( + {movechunk: "test.data", find: {_id: 50}, to: s.getOther(s.getPrimaryShard("test")).name})); + +// Check that we get results rather than an error +var result = d.data + .aggregate({$group: {_id: '$_id', i: {$first: '$i'}}}, + {$group: {_id: '$i', avg_id: {$avg: '$_id'}}}, + {$sort: {_id: 1}}) + .toArray(); +var expected = [ + {"_id": 0, "avg_id": 45}, + {"_id": 1, "avg_id": 46}, + {"_id": 2, "avg_id": 47}, + {"_id": 3, "avg_id": 48}, + {"_id": 4, "avg_id": 49}, + {"_id": 5, "avg_id": 50}, + {"_id": 6, "avg_id": 51}, + {"_id": 7, "avg_id": 52}, + {"_id": 8, "avg_id": 53}, + {"_id": 9, "avg_id": 54} +]; + +assert.eq(result, expected); + +s.stop(); })(); |