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/empty_doc_results.js | |
parent | a025d43f3ce2efc1fb1282a718f5d286fa0a4dc1 (diff) | |
download | mongo-4ae691e8edc87d0e3cfb633bb91c328426be007b.tar.gz |
SERVER-22468 Format JS code with approved style in jstests/
Diffstat (limited to 'jstests/sharding/empty_doc_results.js')
-rw-r--r-- | jstests/sharding/empty_doc_results.js | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/jstests/sharding/empty_doc_results.js b/jstests/sharding/empty_doc_results.js index 6128bffd37b..be63f509532 100644 --- a/jstests/sharding/empty_doc_results.js +++ b/jstests/sharding/empty_doc_results.js @@ -2,25 +2,25 @@ // Verifies that mongos correctly handles empty documents when all fields are projected out // -var options = { mongosOptions : { binVersion : "" }, - shardOptions : { binVersion : "" } }; +var options = { + mongosOptions: {binVersion: ""}, + shardOptions: {binVersion: ""} +}; -var st = new ShardingTest({ shards : 2, other : options }); +var st = new ShardingTest({shards: 2, other: options}); var mongos = st.s0; var coll = mongos.getCollection("foo.bar"); var admin = mongos.getDB("admin"); var shards = mongos.getDB("config").shards.find().toArray(); -assert.commandWorked(admin.runCommand({ enableSharding : coll.getDB().getName() })); -printjson(admin.runCommand({ movePrimary : coll.getDB().getName(), to : shards[0]._id })); -assert.commandWorked(admin.runCommand({ shardCollection: coll.getFullName(), - key: { _id : 1 } })); +assert.commandWorked(admin.runCommand({enableSharding: coll.getDB().getName()})); +printjson(admin.runCommand({movePrimary: coll.getDB().getName(), to: shards[0]._id})); +assert.commandWorked(admin.runCommand({shardCollection: coll.getFullName(), key: {_id: 1}})); -assert.commandWorked(admin.runCommand({ split : coll.getFullName(), middle : { _id : 0 } })); -assert.commandWorked(admin.runCommand({ moveChunk : coll.getFullName(), - find : { _id : 0 }, - to : shards[1]._id })); +assert.commandWorked(admin.runCommand({split: coll.getFullName(), middle: {_id: 0}})); +assert.commandWorked( + admin.runCommand({moveChunk: coll.getFullName(), find: {_id: 0}, to: shards[1]._id})); st.printShardingStatus(); @@ -36,10 +36,10 @@ for (var i = -50; i < 50; i++) { // // Ensure projecting out all fields still returns the same number of documents assert.eq(100, coll.find({}).itcount()); -assert.eq(100, coll.find({}).sort({ positiveId : 1 }).itcount()); -assert.eq(100, coll.find({}, { _id : 0, positiveId : 0 }).itcount()); +assert.eq(100, coll.find({}).sort({positiveId: 1}).itcount()); +assert.eq(100, coll.find({}, {_id: 0, positiveId: 0}).itcount()); // Can't remove sort key from projection (SERVER-11877) but some documents will still be empty -assert.eq(100, coll.find({}, { _id : 0 }).sort({ positiveId : 1 }).itcount()); +assert.eq(100, coll.find({}, {_id: 0}).sort({positiveId: 1}).itcount()); // // @@ -50,8 +50,7 @@ var assertLast50Positive = function(sortedDocs) { for (var i = 0; i < sortedDocs.length; ++i) { if (sortedDocs[i].positiveId) { positiveCount++; - } - else { + } else { // Make sure only the last set of documents have "positiveId" set assert.eq(positiveCount, 0); } @@ -59,8 +58,8 @@ var assertLast50Positive = function(sortedDocs) { assert.eq(positiveCount, 50); }; -assertLast50Positive(coll.find({}).sort({ positiveId : 1 }).toArray()); -assertLast50Positive(coll.find({}, { _id : 0 }).sort({ positiveId : 1 }).toArray()); +assertLast50Positive(coll.find({}).sort({positiveId: 1}).toArray()); +assertLast50Positive(coll.find({}, {_id: 0}).sort({positiveId: 1}).toArray()); jsTest.log("DONE!"); st.stop();
\ No newline at end of file |