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/noPassthrough/change_streams_collation_chunk_migration.js | |
parent | 1e46b5049003f427047e723ea5fab15b5a9253ca (diff) | |
download | mongo-134a4083953270e8a11430395357fb70a29047ad.tar.gz |
SERVER-41772 Apply clang-format 7.0.1 to the codebase
Diffstat (limited to 'jstests/noPassthrough/change_streams_collation_chunk_migration.js')
-rw-r--r-- | jstests/noPassthrough/change_streams_collation_chunk_migration.js | 95 |
1 files changed, 49 insertions, 46 deletions
diff --git a/jstests/noPassthrough/change_streams_collation_chunk_migration.js b/jstests/noPassthrough/change_streams_collation_chunk_migration.js index 4be1044d2d9..51d0536900d 100644 --- a/jstests/noPassthrough/change_streams_collation_chunk_migration.js +++ b/jstests/noPassthrough/change_streams_collation_chunk_migration.js @@ -4,61 +4,64 @@ * @tags: [requires_replication, requires_journaling] */ (function() { - load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection. - load("jstests/libs/change_stream_util.js"); // For 'ChangeStreamTest'. +load("jstests/libs/collection_drop_recreate.js"); // For assert[Drop|Create]Collection. +load("jstests/libs/change_stream_util.js"); // For 'ChangeStreamTest'. - const st = new ShardingTest({ - shards: 2, - mongos: 1, - rs: { - nodes: 1, - }, - }); +const st = new ShardingTest({ + shards: 2, + mongos: 1, + rs: { + nodes: 1, + }, +}); - const testDB = st.s.getDB(jsTestName()); +const testDB = st.s.getDB(jsTestName()); - // Enable sharding on the test database and ensure that the primary is shard0. - assert.commandWorked(testDB.adminCommand({enableSharding: testDB.getName()})); - st.ensurePrimaryShard(testDB.getName(), st.shard0.shardName); +// Enable sharding on the test database and ensure that the primary is shard0. +assert.commandWorked(testDB.adminCommand({enableSharding: testDB.getName()})); +st.ensurePrimaryShard(testDB.getName(), st.shard0.shardName); - const caseInsensitiveCollectionName = "change_stream_case_insensitive"; - const caseInsensitive = {locale: "en_US", strength: 2}; +const caseInsensitiveCollectionName = "change_stream_case_insensitive"; +const caseInsensitive = { + locale: "en_US", + strength: 2 +}; - // Create the collection with a case-insensitive collation, then shard it on {shardKey: 1}. - const caseInsensitiveCollection = assertDropAndRecreateCollection( - testDB, caseInsensitiveCollectionName, {collation: caseInsensitive}); - assert.commandWorked( - caseInsensitiveCollection.createIndex({shardKey: 1}, {collation: {locale: "simple"}})); - assert.commandWorked(testDB.adminCommand({ - shardCollection: caseInsensitiveCollection.getFullName(), - key: {shardKey: 1}, - collation: {locale: "simple"} - })); +// Create the collection with a case-insensitive collation, then shard it on {shardKey: 1}. +const caseInsensitiveCollection = assertDropAndRecreateCollection( + testDB, caseInsensitiveCollectionName, {collation: caseInsensitive}); +assert.commandWorked( + caseInsensitiveCollection.createIndex({shardKey: 1}, {collation: {locale: "simple"}})); +assert.commandWorked(testDB.adminCommand({ + shardCollection: caseInsensitiveCollection.getFullName(), + key: {shardKey: 1}, + collation: {locale: "simple"} +})); - // Verify that the collection does not exist on shard1. - assert(!st.shard1.getCollection(caseInsensitiveCollection.getFullName()).exists()); +// Verify that the collection does not exist on shard1. +assert(!st.shard1.getCollection(caseInsensitiveCollection.getFullName()).exists()); - // Now open a change stream on the collection. - const cst = new ChangeStreamTest(testDB); - const csCursor = cst.startWatchingChanges({ - pipeline: [{$changeStream: {}}, {$project: {docId: "$documentKey.shardKey"}}], - collection: caseInsensitiveCollection - }); +// Now open a change stream on the collection. +const cst = new ChangeStreamTest(testDB); +const csCursor = cst.startWatchingChanges({ + pipeline: [{$changeStream: {}}, {$project: {docId: "$documentKey.shardKey"}}], + collection: caseInsensitiveCollection +}); - // Insert some documents into the collection. - assert.commandWorked(caseInsensitiveCollection.insert({shardKey: 0, text: "aBc"})); - assert.commandWorked(caseInsensitiveCollection.insert({shardKey: 1, text: "abc"})); +// Insert some documents into the collection. +assert.commandWorked(caseInsensitiveCollection.insert({shardKey: 0, text: "aBc"})); +assert.commandWorked(caseInsensitiveCollection.insert({shardKey: 1, text: "abc"})); - // Move a chunk from shard0 to shard1. This will create the collection on shard1. - assert.commandWorked(testDB.adminCommand({ - moveChunk: caseInsensitiveCollection.getFullName(), - find: {shardKey: 1}, - to: st.rs1.getURL(), - _waitForDelete: false - })); +// Move a chunk from shard0 to shard1. This will create the collection on shard1. +assert.commandWorked(testDB.adminCommand({ + moveChunk: caseInsensitiveCollection.getFullName(), + find: {shardKey: 1}, + to: st.rs1.getURL(), + _waitForDelete: false +})); - // Attempt to read from the change stream. We should see both inserts, without an invalidation. - cst.assertNextChangesEqual({cursor: csCursor, expectedChanges: [{docId: 0}, {docId: 1}]}); +// Attempt to read from the change stream. We should see both inserts, without an invalidation. +cst.assertNextChangesEqual({cursor: csCursor, expectedChanges: [{docId: 0}, {docId: 1}]}); - st.stop(); +st.stop(); })(); |